Commit c40cc1e05dc21c75010b74119b554af2ae6e4600

Authored by liquanyu
1 parent a9a0235342

威海体重

Showing 3 changed files with 50 additions and 15 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PatientWeightController.java View file @ c40cc1e
... ... @@ -231,20 +231,20 @@
231 231 * @return
232 232 */
233 233 @ResponseBody
234   - @RequestMapping(value = "/notify",method = RequestMethod.POST)
235   - public BaseResponse notify(List<String> patientIds, HttpServletRequest request) {
236   - return patientWeightService.notify(getUserId(request), patientIds);
  234 + @RequestMapping(value = "/notify/{type}",method = RequestMethod.POST)
  235 + public BaseResponse notify(List<String> patientIds,@PathVariable Integer type, HttpServletRequest request) {
  236 + return patientWeightService.notify(getUserId(request), patientIds,type);
237 237 }
238 238  
239 239 /**
240   - * 医生下面其他没有测量记录的用户
  240 + * 医生端体重管理列表
241 241 * @param doctorId
242 242 * @return
243 243 */
244 244 @ResponseBody
245   - @RequestMapping(value = "/getSevenNotWeights/{doctorId}", method = RequestMethod.GET)
246   - public BaseResponse getSevenNotWeights(@PathVariable String doctorId) {
247   - return patientWeightService.getSevenNotWeights(doctorId);
  245 + @RequestMapping(value = "/getWeights/{doctorId}/{type}", method = RequestMethod.GET)
  246 + public BaseResponse getWeights(@PathVariable String doctorId,@PathVariable Integer type,@PathVariable Integer status) {
  247 + return patientWeightService.getWeights(doctorId,type,status);
248 248 }
249 249 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/PatientWeightService.java View file @ c40cc1e
... ... @@ -43,8 +43,8 @@
43 43 WeightConfigModel getWeightConfigBykcal(Map<String, String> map, String northSouth, String risk);
44 44  
45 45  
46   - BaseResponse notify(Integer userId, List<String> patientIds);
  46 + BaseResponse notify(Integer userId, List<String> patientIds,Integer type);
47 47  
48   - BaseResponse getSevenNotWeights(String doctorId);
  48 + BaseResponse getWeights(String doctorId,Integer type,Integer status);
49 49 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java View file @ c40cc1e
... ... @@ -1747,7 +1747,7 @@
1747 1747 }
1748 1748  
1749 1749 @Override
1750   - public BaseResponse notify(Integer userId, final List<String> patientIds) {
  1750 + public BaseResponse notify(Integer userId, final List<String> patientIds,final Integer type) {
1751 1751  
1752 1752 new Thread(new Runnable() {
1753 1753 @Override
... ... @@ -1759,6 +1759,20 @@
1759 1759 Patients patient = patientsService.findOnePatientById(patientId);
1760 1760 if (patient != null)
1761 1761 {
  1762 +
  1763 + PatientWeight patientWeight = mongoTemplate.findOne(Query.query(Criteria.where("patientId").is(patient.getId()).and("yn").ne("1")), PatientWeight.class);
  1764 + if (type == 1 && patientWeight != null)
  1765 + {
  1766 + Date currentDate = new Date();
  1767 + DateUtil.formatYmd(currentDate);
  1768 + if (!(patientWeight.getModified().getTime() < new Date().getTime()
  1769 + && patientWeight.getModified().getTime() > currentDate.getTime()))
  1770 + {
  1771 + continue;
  1772 + }
  1773 + }
  1774 +
  1775 +
1762 1776 SmsConfigModel configModel = new SmsConfigModel();
1763 1777 // 1 推送服务, 2 推送和短信服务 3短信服务,
1764 1778 int startType = smsConfigFacade.hospitalIsStart(patient.getHospitalId(), configModel, SmsServiceEnums.TZTX.getId());
... ... @@ -1772,8 +1786,19 @@
1772 1786  
1773 1787 List<MsgRequest> messages = new ArrayList<>();
1774 1788 MsgRequest mr = new MsgRequest();
1775   - String content = "您好,您设置的体重记录时间到了,请尽快打开小程序记录您今天的体重信息吧。";
1776   -
  1789 + String content = "";
  1790 + if (type == 1)
  1791 + {
  1792 + content = "您好,您设置的体重记录时间到了,请尽快打开小程序记录您今天的体重信息吧。";
  1793 + }
  1794 + else if (type == 2)
  1795 + {
  1796 + content = "亲爱的准妈妈您好,我是您的私人体重管理医生,您目前已经很久没有记录您的体重值了,为了您和您孩子的健康,请您务必每天记录一下自己的体重,好让我们能随时关注到您和宝宝的健康状况,谢谢!";
  1797 + }
  1798 + else if (type == 3)
  1799 + {
  1800 + content = "亲爱的准妈妈您好,我是您的私人体重管理医生,您目前的体重数据十分不理想,请您迅速与我联系或来院进行复查身体情况。";
  1801 + }
1777 1802 mr.setFirst("【" + messagePrefix + "】" + content);
1778 1803 mr.setObjType(ServiceObjEnums.YUNOBJ.getId());
1779 1804 mr.setPhone(patient.getPhone());
... ... @@ -1814,6 +1839,12 @@
1814 1839 if (CollectionUtils.isNotEmpty(messages)) {
1815 1840 smsConfigFacade.saveMsg(messages, patient.getHospitalId());
1816 1841 }
  1842 +
  1843 + if (patientWeight != null)
  1844 + {
  1845 + patientWeightService2.update(Query.query(Criteria.where("id").is(patientWeight.getId())), patientWeight);
  1846 + }
  1847 +
1817 1848 }
1818 1849 }
1819 1850 }
1820 1851  
... ... @@ -1823,10 +1854,11 @@
1823 1854 }
1824 1855  
1825 1856 @Override
1826   - public BaseResponse getSevenNotWeights(String doctorId) {
  1857 + public BaseResponse getWeights(String doctorId,Integer type,Integer status) {
1827 1858 PatientServiceQuery patientQuery = new PatientServiceQuery();
1828 1859 patientQuery.setSerDoct(doctorId);
1829 1860 patientQuery.setSerType(PatientSerEnums.SerTypeEnums.tz.getId());
  1861 + patientQuery.setSerStatus(1);
1830 1862 List<PatientService> list = patientServiceService.queryPatientService(patientQuery);
1831 1863 List<String> patientIds = new ArrayList<>();
1832 1864 List<Map> datas = new ArrayList<>();
... ... @@ -1837,6 +1869,7 @@
1837 1869 patientIds.add(ps.getParentid());
1838 1870 }
1839 1871 }
  1872 +
1840 1873 if (CollectionUtils.isNotEmpty(patientIds))
1841 1874 {
1842 1875 List<PatientWeight> weights = mongoTemplate.find(Query.query(Criteria.where("patientId").in(patientIds).and("modified").lte(DateUtil.addDay(new Date(),-7))), PatientWeight.class);
... ... @@ -1849,8 +1882,10 @@
1849 1882 map.put("name",patients != null ? patients.getUsername() : "");
1850 1883 map.put("age",patients != null ? DateUtil.getAge(patients.getBirth(), weight.getModified()): "");
1851 1884 map.put("week",patients != null ? DateUtil.getWeekDesc(patients.getLastMenses(), weight.getModified()): "");
1852   - map.put("weight",weight.getNowWeight());
1853   - map.put("days",DateUtil.getDays(weight.getModified(),new Date()));
  1885 + map.put("nowWeight",weight.getNowWeight());
  1886 + map.put("days",DateUtil.getDays(weight.getModified(), new Date()));
  1887 + map.put("phone",patients.getPhone());
  1888 + map.put("cumulWeight",getDiff(weight.getBeforeWeight(),weight.getNowWeight()));
1854 1889 }
1855 1890 }
1856 1891 }