Commit 5ff149d521ffc32861901623c60c95a816c4c29e

Authored by zhangchao
1 parent e0b08e22cf
Exists in dev

#fix:新增服务名目通知

Showing 5 changed files with 70 additions and 4 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IBloodPressureService.java View file @ 5ff149d
... ... @@ -12,7 +12,7 @@
12 12 BaseResponse addOrUpdate(Integer userId, BloodPressure bloodPressure);
13 13  
14 14 BaseResponse list(String key, String vcCardNo, Integer weekStart,
15   - Integer weekEnd, Integer age, Integer page, Integer limit, Integer isPrint,Integer userId,String type);
  15 + Integer weekEnd, Integer age, Integer page, Integer limit, Integer isPrint,Integer userId,String type,Integer level);
16 16  
17 17 BaseResponse info(String id, Date startDate);
18 18  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IBloodSugarService.java View file @ 5ff149d
... ... @@ -12,13 +12,15 @@
12 12  
13 13 BaseResponse add(Integer userId, BloodSugar bloodSugar);
14 14  
15   - BaseResponse list(String isAll,String key, String vcCardNo, Integer weekStart, Integer weekEnd, Integer age, Integer page, Integer limit,Integer isPrint, Integer userId);
  15 + BaseResponse list(String isAll,String key, String vcCardNo, Integer weekStart, Integer weekEnd, Integer age, Integer page, Integer limit,Integer isPrint, Integer userId,Integer type);
16 16  
17 17 BaseResponse info(String parentId, Integer type, Date time);
18 18  
19 19 BaseResponse getAppInfo(String parentId);
20 20  
21 21 BaseResponse initBloodSugar(Map<String, String> param);
  22 +
  23 + void initSugar();
22 24  
23 25 BaseResponse init();
24 26  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BaseServiceImpl.java View file @ 5ff149d
... ... @@ -48,6 +48,7 @@
48 48 query.skip((page - 1) * limit);
49 49 query.limit(limit);
50 50 List<T> rows = mongoTemplate.find(query, entity);
  51 + //System.out.println(query.toString());
51 52 return new PageResult(count.intValue(), page, limit, rows);
52 53 }
53 54 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodPressureServiceImpl.java View file @ 5ff149d
... ... @@ -212,9 +212,13 @@
212 212 return RespBuilder.buildSuccess();
213 213 }
214 214  
  215 + /**
  216 + * @param type 1正常血压管理、2低血压管理、3妊高症管理
  217 + * @return
  218 + */
215 219 @Override
216 220 public BaseResponse list(String key, String vcCardNo, Integer weekStart, Integer
217   - weekEnd, Integer age, Integer page, Integer limit,Integer isPrint, Integer userId,String isAll) {
  221 + weekEnd, Integer age, Integer page, Integer limit,Integer isPrint, Integer userId,String isAll,Integer type) {
218 222 boolean flag = false;
219 223 List<String> hospitalIds = groupsFacade.findGroupHospital(userId, false);
220 224 String hospitalId = autoMatchFacade.getHospitalId(userId);
... ... @@ -231,6 +235,7 @@
231 235  
232 236 Criteria criteria = Criteria.where("yn").is(1).and("hospitalId").in(hids);
233 237 Criteria pCriteria = Criteria.where("yn").is(1).and("hospitalId").in(hospitalIds);
  238 +
234 239 if (StringUtils.isNotEmpty(key)) {
235 240 flag = true;
236 241 pCriteria.orOperator(Criteria.where("phone").regex(key), Criteria.where("username").regex(key), Criteria.where("cardNo").is(key));
... ... @@ -273,6 +278,19 @@
273 278  
274 279 if(null!=isPrint){
275 280 criteria.and("isPrint").is(isPrint);
  281 + }
  282 + if (type!=null){
  283 + // 90-140
  284 + if (type==1){
  285 + criteria.and("$where").is(
  286 + String.format("this.ssy>= %s && this.ssy<= %s", "90","140"));
  287 + }else if (type==2){
  288 + criteria.and("$where").is(
  289 + String.format("this.ssy< %s", "90"));
  290 + }else if (type==3){
  291 + criteria.and("$where").is(
  292 + String.format("this.ssy> %s", "140"));
  293 + }
276 294 }
277 295 PageResult pageResult = findMongoPage(BloodPressure.class, new Query(criteria).with(new Sort(Sort.Direction.DESC, "modified")), page, limit);
278 296 List<BloodPressure> bloodPressures = (List<BloodPressure>) pageResult.getGrid();
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodSugarServiceImpl.java View file @ 5ff149d
... ... @@ -13,6 +13,7 @@
13 13 import com.lyms.platform.common.utils.StringUtils;
14 14 import com.lyms.platform.operate.web.constant.OrganizationConstant;
15 15 import com.lyms.platform.operate.web.facade.*;
  16 +import com.lyms.platform.operate.web.result.BabyEarAddResult;
16 17 import com.lyms.platform.operate.web.result.DiabetesRecordResult;
17 18 import com.lyms.platform.operate.web.service.IBloodSugarService;
18 19 import com.lyms.platform.operate.web.service.PatientWeightService;
19 20  
... ... @@ -35,11 +36,13 @@
35 36 import org.apache.commons.collections.MapUtils;
36 37 import org.apache.commons.collections.map.HashedMap;
37 38 import org.springframework.beans.factory.annotation.Autowired;
  39 +import org.springframework.beans.factory.annotation.Qualifier;
38 40 import org.springframework.data.domain.Sort;
39 41 import org.springframework.data.mongodb.core.MongoTemplate;
40 42 import org.springframework.data.mongodb.core.query.Criteria;
41 43 import org.springframework.data.mongodb.core.query.Query;
42 44 import org.springframework.data.mongodb.core.query.Update;
  45 +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
43 46 import org.springframework.stereotype.Service;
44 47  
45 48 import java.lang.reflect.InvocationTargetException;
... ... @@ -103,6 +106,9 @@
103 106  
104 107 @Autowired
105 108 private UsersService usersService;
  109 + @Autowired
  110 + @Qualifier("commonThreadPool")
  111 + private ThreadPoolTaskExecutor commonThreadPool;
106 112  
107 113 public BaseResponse add(Integer userId, BloodSugar bloodSugar) {
108 114 String pid = mongoUtil.getPid(bloodSugar.getParentId());
... ... @@ -124,6 +130,7 @@
124 130 bloodSugar.setModified(new Date());
125 131 bloodSugar.setCreatYmdDate(DateUtil.getyyyy_MM_dd(new Date()));
126 132 bloodSugar.setPid(mongoUtil.getPid(bloodSugar.getParentId()));
  133 +
127 134 bloodSugarService.add(bloodSugar);
128 135  
129 136 Update up = new Update();
130 137  
... ... @@ -132,8 +139,13 @@
132 139 return RespBuilder.buildSuccess(bloodSugar.getId());
133 140 }
134 141  
  142 + /**
  143 + *
  144 + * @param type 1正常血糖管理、2低血糖管理、3高血糖管理
  145 + * @return
  146 + */
135 147 @Override
136   - public BaseResponse list(String isAll,String key, String vcCardNo, Integer weekStart, Integer weekEnd, Integer age, Integer page, Integer limit,Integer isPrint, Integer userId) {
  148 + public BaseResponse list(String isAll,String key, String vcCardNo, Integer weekStart, Integer weekEnd, Integer age, Integer page, Integer limit,Integer isPrint, Integer userId,Integer type) {
137 149 boolean flag = false;
138 150 if (StringUtils.isNotEmpty(key) || StringUtils.isNotEmpty(vcCardNo) || weekEnd != null || weekStart != null || age != null) {
139 151 flag = true;
... ... @@ -151,6 +163,10 @@
151 163 }
152 164 Criteria criteria = Criteria.where("yn").is(1);
153 165 criteria.and("hospitalId").in(hids);
  166 + if (type!=null){
  167 + //1正常血糖管理、2低血糖管理、3高血糖管理
  168 + criteria.and("sugarType").is(type);
  169 + }
154 170 if (flag) {
155 171 List<String> pids = mongoUtil.getPidsByCondition2(hospitalIds, key, vcCardNo, weekStart, weekEnd, age);
156 172 criteria.and("pid").in(pids);
... ... @@ -355,6 +371,14 @@
355 371 if (!flag) {
356 372 bloodSugarService.add(one);
357 373 } else {
  374 + String str= getBloodSugarStatus(one.getBloodSugarType(), one.getBloodSugar());
  375 + Integer type=1;
  376 + if (str.equals("高血糖")){
  377 + type=3;
  378 + }else if (str.equals("低血糖")){
  379 + type=2;
  380 + }
  381 + one.setSugarType(type);
358 382 mongoTemplate.save(one);
359 383 }
360 384  
... ... @@ -1673,6 +1697,27 @@
1673 1697 }
1674 1698 }
1675 1699 return RespBuilder.buildSuccess(restList);
  1700 + }
  1701 +
  1702 + public void initSugar(){
  1703 + final List<BloodSugar> bloodSugars = mongoTemplate.find( new Query(new Criteria().and("yn").is(1)),BloodSugar.class);
  1704 + commonThreadPool.execute(new Runnable() {
  1705 + @Override
  1706 + public void run() {
  1707 + Update update = new Update();
  1708 + for (BloodSugar bloodSugar:bloodSugars){
  1709 + String str= getBloodSugarStatus(bloodSugar.getBloodSugarType(), bloodSugar.getBloodSugar());
  1710 + Integer type=1;
  1711 + if (str.equals("高血糖")){
  1712 + type=3;
  1713 + }else if (str.equals("低血糖")){
  1714 + type=2;
  1715 + }
  1716 + update.set("sugarType",type);
  1717 + mongoTemplate.upsert( new Query(new Criteria().and("id").is(bloodSugar.getId())),update, BloodSugar.class);
  1718 + }
  1719 + }
  1720 + });
1676 1721 }
1677 1722 }