Commit 70beb2c741e4ff1268515688527c2b15d8e43684
Exists in
master
and in
6 other branches
Merge remote-tracking branch 'origin/master'
Showing 10 changed files
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IBloodPressureDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/BloodPressureDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BloodPressureService.java
- platform-dal/src/main/java/com/lyms/platform/beans/SerialIdEnum.java
- platform-dal/src/main/java/com/lyms/platform/pojo/BloodPressure.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BloodPressureController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/RiskReportFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IBloodPressureService.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodPressureServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MongoUtil.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IBloodPressureDao.java
View file @
70beb2c
1 | +package com.lyms.platform.biz.dal; | |
2 | + | |
3 | +import com.lyms.platform.pojo.BloodPressure; | |
4 | +import org.springframework.data.mongodb.core.query.Query; | |
5 | + | |
6 | +/** | |
7 | + * 血压 | |
8 | + */ | |
9 | +public interface IBloodPressureDao { | |
10 | + | |
11 | + void add(BloodPressure bloodPressure); | |
12 | + | |
13 | + void updateXy(Query query, BloodPressure bloodPressure); | |
14 | + | |
15 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/BloodPressureDaoImpl.java
View file @
70beb2c
1 | +package com.lyms.platform.biz.dal.impl; | |
2 | + | |
3 | +import com.lyms.platform.biz.dal.IBloodPressureDao; | |
4 | +import com.lyms.platform.common.dao.BaseMongoDAOImpl; | |
5 | +import com.lyms.platform.pojo.BloodPressure; | |
6 | +import org.springframework.data.mongodb.core.query.Query; | |
7 | +import org.springframework.stereotype.Repository; | |
8 | + | |
9 | +@Repository | |
10 | +public class BloodPressureDaoImpl extends BaseMongoDAOImpl<BloodPressure> implements IBloodPressureDao { | |
11 | + | |
12 | + @Override | |
13 | + public void add(BloodPressure bloodPressure) { | |
14 | + save(bloodPressure); | |
15 | + } | |
16 | + | |
17 | + @Override | |
18 | + public void updateXy(Query query, BloodPressure bloodPressure) { | |
19 | + update(query, bloodPressure); | |
20 | + } | |
21 | + | |
22 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BloodPressureService.java
View file @
70beb2c
1 | +package com.lyms.platform.biz.service; | |
2 | + | |
3 | + | |
4 | +import com.lyms.platform.biz.dal.IBloodPressureDao; | |
5 | +import com.lyms.platform.pojo.BloodPressure; | |
6 | +import org.springframework.beans.factory.annotation.Autowired; | |
7 | +import org.springframework.data.mongodb.core.query.Criteria; | |
8 | +import org.springframework.data.mongodb.core.query.Query; | |
9 | +import org.springframework.stereotype.Service; | |
10 | + | |
11 | +@Service | |
12 | +public class BloodPressureService { | |
13 | + | |
14 | + @Autowired | |
15 | + private IBloodPressureDao bloodPressureDao; | |
16 | + | |
17 | + public void add(BloodPressure bloodPressure) { | |
18 | + bloodPressureDao.add(bloodPressure); | |
19 | + } | |
20 | + | |
21 | + public void update(BloodPressure bloodPressure) { | |
22 | + bloodPressureDao.updateXy(Query.query(Criteria.where("id").is(bloodPressure.getId())), bloodPressure); | |
23 | + } | |
24 | + | |
25 | +} |
platform-dal/src/main/java/com/lyms/platform/beans/SerialIdEnum.java
View file @
70beb2c
... | ... | @@ -57,6 +57,7 @@ |
57 | 57 | PatientCheckTicket("PatientCheckTicket", 97531000450L), |
58 | 58 | AntExPRecordModel("AntExPRecordModel", 97531000451L), |
59 | 59 | PatientWeight("PatientWeight", 97531000111L), |
60 | + BloodPressure("BloodPressure", 97531333111L), | |
60 | 61 | last("last", 97531009990L); |
61 | 62 | private String cname; |
62 | 63 | private Long cid; |
platform-dal/src/main/java/com/lyms/platform/pojo/BloodPressure.java
View file @
70beb2c
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 | +import java.util.Map; | |
9 | + | |
10 | +/** | |
11 | + * 血压 | |
12 | + */ | |
13 | +@Document(collection="lyms_blood_pressure") | |
14 | +public class BloodPressure extends BaseModel { | |
15 | + | |
16 | + private static final long serialVersionUID = SerialIdEnum.PatientWeight.getCid(); | |
17 | + | |
18 | + private String id; | |
19 | + | |
20 | + private String parentId; | |
21 | + | |
22 | + private Date created; | |
23 | + | |
24 | + private Date modified; | |
25 | + | |
26 | + private Integer yn; | |
27 | + | |
28 | + private Integer operaterId; | |
29 | + | |
30 | + private String hospitalId; | |
31 | + | |
32 | + // 舒张压 | |
33 | + private String szy; | |
34 | + // 收缩压 | |
35 | + private String ssy; | |
36 | + // 脉搏 | |
37 | + private Integer pulse; | |
38 | + | |
39 | + private Map<String, Map<String, Object>> infos; | |
40 | + | |
41 | + public String getSzy() { | |
42 | + return szy; | |
43 | + } | |
44 | + | |
45 | + public void setSzy(String szy) { | |
46 | + this.szy = szy; | |
47 | + } | |
48 | + | |
49 | + public String getSsy() { | |
50 | + return ssy; | |
51 | + } | |
52 | + | |
53 | + public void setSsy(String ssy) { | |
54 | + this.ssy = ssy; | |
55 | + } | |
56 | + | |
57 | + public Integer getPulse() { | |
58 | + return pulse; | |
59 | + } | |
60 | + | |
61 | + public void setPulse(Integer pulse) { | |
62 | + this.pulse = pulse; | |
63 | + } | |
64 | + | |
65 | + public String getId() { | |
66 | + return id; | |
67 | + } | |
68 | + | |
69 | + public void setId(String id) { | |
70 | + this.id = id; | |
71 | + } | |
72 | + | |
73 | + public String getParentId() { | |
74 | + return parentId; | |
75 | + } | |
76 | + | |
77 | + public void setParentId(String parentId) { | |
78 | + this.parentId = parentId; | |
79 | + } | |
80 | + | |
81 | + public Date getCreated() { | |
82 | + return created; | |
83 | + } | |
84 | + | |
85 | + public void setCreated(Date created) { | |
86 | + this.created = created; | |
87 | + } | |
88 | + | |
89 | + public Date getModified() { | |
90 | + return modified; | |
91 | + } | |
92 | + | |
93 | + public void setModified(Date modified) { | |
94 | + this.modified = modified; | |
95 | + } | |
96 | + | |
97 | + public Integer getYn() { | |
98 | + return yn; | |
99 | + } | |
100 | + | |
101 | + public void setYn(Integer yn) { | |
102 | + this.yn = yn; | |
103 | + } | |
104 | + | |
105 | + public Integer getOperaterId() { | |
106 | + return operaterId; | |
107 | + } | |
108 | + | |
109 | + public void setOperaterId(Integer operaterId) { | |
110 | + this.operaterId = operaterId; | |
111 | + } | |
112 | + | |
113 | + public String getHospitalId() { | |
114 | + return hospitalId; | |
115 | + } | |
116 | + | |
117 | + public void setHospitalId(String hospitalId) { | |
118 | + this.hospitalId = hospitalId; | |
119 | + } | |
120 | + | |
121 | + public Map<String, Map<String, Object>> getInfos() { | |
122 | + return infos; | |
123 | + } | |
124 | + | |
125 | + public void setInfos(Map<String, Map<String, Object>> infos) { | |
126 | + this.infos = infos; | |
127 | + } | |
128 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BloodPressureController.java
View file @
70beb2c
1 | +package com.lyms.platform.operate.web.controller; | |
2 | + | |
3 | +import com.lyms.platform.common.annotation.TokenRequired; | |
4 | +import com.lyms.platform.common.base.BaseController; | |
5 | +import com.lyms.platform.common.result.BaseResponse; | |
6 | +import com.lyms.platform.operate.web.service.IBloodPressureService; | |
7 | +import com.lyms.platform.pojo.BloodPressure; | |
8 | +import org.springframework.beans.factory.annotation.Autowired; | |
9 | +import org.springframework.stereotype.Controller; | |
10 | +import org.springframework.web.bind.annotation.PathVariable; | |
11 | +import org.springframework.web.bind.annotation.RequestMapping; | |
12 | +import org.springframework.web.bind.annotation.RequestMethod; | |
13 | +import org.springframework.web.bind.annotation.ResponseBody; | |
14 | + | |
15 | +import javax.servlet.http.HttpServletRequest; | |
16 | + | |
17 | +/** | |
18 | + * 血压 | |
19 | + */ | |
20 | +@Controller | |
21 | +@RequestMapping("/xy") | |
22 | +public class BloodPressureController extends BaseController { | |
23 | + | |
24 | + @Autowired | |
25 | + private IBloodPressureService bloodPressureService; | |
26 | + | |
27 | + @ResponseBody | |
28 | + @RequestMapping(method = RequestMethod.POST) | |
29 | + @TokenRequired | |
30 | + public BaseResponse addOrUpdate(BloodPressure bloodPressure, HttpServletRequest request) { | |
31 | + return bloodPressureService.addOrUpdate(getUserId(request), bloodPressure); | |
32 | + } | |
33 | + | |
34 | + @ResponseBody | |
35 | + @RequestMapping(method = RequestMethod.GET) | |
36 | + @TokenRequired | |
37 | + public BaseResponse list(String key, String vcCardNo, Integer weekStart, Integer weekEnd, Integer age, Integer page, Integer limit, HttpServletRequest request) { | |
38 | + return bloodPressureService.list(key, vcCardNo, weekStart, weekEnd, age, page, limit, getUserId(request)); | |
39 | + } | |
40 | + | |
41 | + @ResponseBody | |
42 | + @RequestMapping(value = "/{id}", method = RequestMethod.GET) | |
43 | + @TokenRequired | |
44 | + public BaseResponse info(@PathVariable String id) { | |
45 | + return bloodPressureService.info(id); | |
46 | + } | |
47 | + | |
48 | + | |
49 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/RiskReportFacade.java
View file @
70beb2c
... | ... | @@ -557,43 +557,11 @@ |
557 | 557 | } |
558 | 558 | map.put("data",items); |
559 | 559 | series.add(map); |
560 | - | |
561 | - | |
562 | - | |
563 | -// List<Map<String,Object>> bfbItem = new ArrayList<>(); | |
564 | -// | |
565 | -// if (CollectionUtils.isNotEmpty(series)) | |
566 | -// { | |
567 | -// int index = 0; | |
568 | -// for (Map<String,Object> seriseMap : series) | |
569 | -// { | |
570 | -// Map<String,Object> percent = new HashMap<>(); | |
571 | -// percent.put("name",seriseMap.get("name")); | |
572 | -// percent.put("type","line"); | |
573 | -// | |
574 | -// | |
575 | -// //占比/环比百分比 | |
576 | -// List<String> bfb = new ArrayList<>(); | |
577 | -// | |
578 | -// | |
579 | -// index++; | |
580 | -// List colums = (List)seriseMap.get("data"); | |
581 | -// Object obj = colums.get(index); | |
582 | -// int total = 0; | |
583 | -// | |
584 | -// for (Map<String,Object> sMap : series) | |
585 | -// { | |
586 | -// List colums1 = (List)sMap.get("data"); | |
587 | -// Object obj1 = colums1.get(index); | |
588 | -// | |
589 | -// total += Integer.valueOf(String.valueOf(obj1)); | |
590 | -// } | |
591 | -// bfb.add(MathUtil.getProportion(Integer.valueOf(String.valueOf(obj)),total); | |
592 | -// } | |
593 | -// } | |
594 | - | |
595 | - | |
596 | 560 | } |
561 | + | |
562 | + //计算占比 | |
563 | + List<Map<String,Object>> bfbItem = handzb(series); | |
564 | + series.addAll(bfbItem); | |
597 | 565 | } |
598 | 566 | } |
599 | 567 | else if (addrType == 3) |
... | ... | @@ -639,6 +607,10 @@ |
639 | 607 | } |
640 | 608 | series.add(map); |
641 | 609 | } |
610 | + | |
611 | + //计算占比 | |
612 | + List<Map<String,Object>> bfbItem = handzb(series); | |
613 | + series.addAll(bfbItem); | |
642 | 614 | } |
643 | 615 | } |
644 | 616 | datas.put("series",series); |
... | ... | @@ -648,6 +620,47 @@ |
648 | 620 | return new BaseObjectResponse() |
649 | 621 | .setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS).setData(datas); |
650 | 622 | } |
623 | + | |
624 | + /** | |
625 | + * 占比计算 | |
626 | + * @param series | |
627 | + * @return | |
628 | + */ | |
629 | + private List<Map<String,Object>> handzb(List<Map<String,Object>> series) | |
630 | + { | |
631 | + List<Map<String,Object>> bfbItem = new ArrayList<>(); | |
632 | + if (CollectionUtils.isNotEmpty(series)) | |
633 | + { | |
634 | + for (Map<String,Object> seriseMap : series) | |
635 | + { | |
636 | + List<String> bfb = new ArrayList<>(); | |
637 | + Map<String,Object> bfbMap = new HashMap<>(); | |
638 | + bfbMap.put("name",seriseMap.get("name")); | |
639 | + bfbMap.put("type","line"); | |
640 | + | |
641 | + List colums = (List)seriseMap.get("data"); | |
642 | + | |
643 | + for (int i = 0 ;i < colums.size() ;i++) | |
644 | + { | |
645 | + Object obj = colums.get(i); | |
646 | + int total = 0; | |
647 | + for (int j = 0 ;j < colums.size() ;j++) | |
648 | + { | |
649 | + Object obj1 = colums.get(j); | |
650 | + | |
651 | + total += Integer.valueOf(String.valueOf(obj1)); | |
652 | + } | |
653 | + bfb.add(MathUtil.getProportion(Integer.valueOf(String.valueOf(obj)),total)); | |
654 | + bfbMap.put("data",bfb); | |
655 | + } | |
656 | + bfbItem.add(bfbMap); | |
657 | + } | |
658 | + } | |
659 | + | |
660 | + return bfbItem; | |
661 | + | |
662 | + } | |
663 | + | |
651 | 664 | |
652 | 665 | /** |
653 | 666 | * 表格标题 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IBloodPressureService.java
View file @
70beb2c
1 | +package com.lyms.platform.operate.web.service; | |
2 | + | |
3 | +import com.lyms.platform.common.result.BaseResponse; | |
4 | +import com.lyms.platform.pojo.BloodPressure; | |
5 | + | |
6 | +public interface IBloodPressureService extends IBaseService { | |
7 | + | |
8 | + BaseResponse addOrUpdate(Integer userId, BloodPressure bloodPressure); | |
9 | + | |
10 | + BaseResponse list(String key, String vcCardNo, Integer weekStart, Integer weekEnd, Integer age, Integer page, Integer limit, Integer userId); | |
11 | + | |
12 | + BaseResponse info(String id); | |
13 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodPressureServiceImpl.java
View file @
70beb2c
1 | +package com.lyms.platform.operate.web.service.impl; | |
2 | + | |
3 | +import com.lyms.platform.biz.service.BloodPressureService; | |
4 | +import com.lyms.platform.biz.service.CommonService; | |
5 | +import com.lyms.platform.common.enums.YnEnums; | |
6 | +import com.lyms.platform.common.result.BaseResponse; | |
7 | +import com.lyms.platform.common.result.PageResult; | |
8 | +import com.lyms.platform.common.result.RespBuilder; | |
9 | +import com.lyms.platform.common.utils.DateUtil; | |
10 | +import com.lyms.platform.common.utils.StringUtils; | |
11 | +import com.lyms.platform.operate.web.facade.AccessPermissionFacade; | |
12 | +import com.lyms.platform.operate.web.facade.AutoMatchFacade; | |
13 | +import com.lyms.platform.operate.web.service.IBloodPressureService; | |
14 | +import com.lyms.platform.operate.web.utils.CollectionUtils; | |
15 | +import com.lyms.platform.operate.web.utils.MongoUtil; | |
16 | +import com.lyms.platform.pojo.BloodPressure; | |
17 | +import com.lyms.platform.pojo.Patients; | |
18 | +import org.springframework.beans.factory.annotation.Autowired; | |
19 | +import org.springframework.data.domain.Sort; | |
20 | +import org.springframework.data.mongodb.core.MongoTemplate; | |
21 | +import org.springframework.data.mongodb.core.query.Criteria; | |
22 | +import org.springframework.data.mongodb.core.query.Query; | |
23 | +import org.springframework.stereotype.Service; | |
24 | + | |
25 | +import java.util.*; | |
26 | + | |
27 | +@Service | |
28 | +public class BloodPressureServiceImpl extends BaseServiceImpl implements IBloodPressureService { | |
29 | + | |
30 | + @Autowired | |
31 | + private BloodPressureService bloodPressureService; | |
32 | + | |
33 | + @Autowired | |
34 | + private MongoTemplate mongoTemplate; | |
35 | + | |
36 | + @Autowired | |
37 | + private AutoMatchFacade autoMatchFacade; | |
38 | + | |
39 | + @Autowired | |
40 | + private MongoUtil mongoUtil; | |
41 | + | |
42 | + @Autowired | |
43 | + private CommonService commonService; | |
44 | + | |
45 | + @Autowired | |
46 | + private AccessPermissionFacade accessPermissionFacade; | |
47 | + | |
48 | + | |
49 | + public BaseResponse addOrUpdate(Integer userId, BloodPressure bloodPressure) { | |
50 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
51 | + Map<String, Object> temp = new LinkedHashMap<>(); | |
52 | + temp.put("szy", bloodPressure.getSzy()); | |
53 | + temp.put("ssy", bloodPressure.getSsy()); | |
54 | + temp.put("pulse", bloodPressure.getPulse()); | |
55 | + temp.put("hospitalId", hospitalId); | |
56 | + if(StringUtils.isEmpty(bloodPressure.getId())) { | |
57 | + String parentId = mongoUtil.doHidePatient(bloodPressure.getParentId(), hospitalId); | |
58 | + bloodPressure.setParentId(parentId); | |
59 | + bloodPressure.setYn(YnEnums.YES.getId()); | |
60 | + bloodPressure.setCreated(new Date()); | |
61 | + bloodPressure.setHospitalId(hospitalId); | |
62 | + bloodPressure.setOperaterId(userId); | |
63 | + Map<String, Map<String, Object>> infos = new LinkedHashMap<>(); | |
64 | + infos.put(DateUtil.getyyyy_MM_dd(new Date()), temp); | |
65 | + bloodPressure.setInfos(infos); | |
66 | + bloodPressureService.add(bloodPressure); | |
67 | + } else { | |
68 | + Map<String, Map<String, Object>> infos = mongoTemplate.findById(bloodPressure.getId(), BloodPressure.class).getInfos(); | |
69 | + infos.put(DateUtil.getyyyy_MM_dd(new Date()), temp); | |
70 | + bloodPressureService.update(bloodPressure); | |
71 | + } | |
72 | + return RespBuilder.buildSuccess(); | |
73 | + } | |
74 | + | |
75 | + @Override | |
76 | + public BaseResponse list(String key, String vcCardNo, Integer weekStart, Integer weekEnd, Integer age, Integer page, Integer limit, Integer userId) { | |
77 | + List<String> hospitalIds = accessPermissionFacade.getCurrentUserHospPermissions(userId); | |
78 | + Criteria criteria = Criteria.where("yn").ne("0").and("hospitalId").in(hospitalIds); | |
79 | + Criteria pCriteria = Criteria.where("yn").ne("0").and("hospitalId").in(hospitalIds); | |
80 | + if(StringUtils.isNotEmpty(key)) { | |
81 | + pCriteria.orOperator(Criteria.where("phone").regex(key), Criteria.where("username").regex(key), Criteria.where("cardNo").is(key)); | |
82 | + } | |
83 | + if(StringUtils.isNotEmpty(vcCardNo)) { | |
84 | + pCriteria.and("vcCardNo").is(vcCardNo); | |
85 | + } | |
86 | + if(weekStart != null && weekEnd != null) { | |
87 | + Date start = DateUtil.getWeekStart(weekEnd); | |
88 | + Date end = DateUtil.getWeekEnd(weekStart); | |
89 | + pCriteria.and("lastMenses").gt(start).lte(end); | |
90 | + } | |
91 | + if(age != null) { | |
92 | + Date start = DateUtil.getBeforeAge(age); | |
93 | + Date end = DateUtil.getBeforeAge(age + 1); | |
94 | + pCriteria.and("birth").gt(end).lte(start); | |
95 | + } | |
96 | + List<Patients> patients = mongoTemplate.find(Query.query(pCriteria), Patients.class); | |
97 | + List<String> ids = new ArrayList<>(); | |
98 | + if(CollectionUtils.isNotEmpty(patients)) { | |
99 | + for (Patients patient : patients) { | |
100 | + ids.add(patient.getId()); | |
101 | + } | |
102 | + } | |
103 | + criteria.and("parentId").in(ids); | |
104 | + PageResult pageResult = findMongoPage(BloodPressure.class, new Query(criteria).with(new Sort(Sort.Direction.DESC, "created")), page, limit); | |
105 | + List<BloodPressure> bloodPressures = (List<BloodPressure>) pageResult.getGrid(); | |
106 | + List<Map<String, Object>> restList = new ArrayList<>(); | |
107 | + for (BloodPressure bloodPressure : bloodPressures) { | |
108 | + Map<String, Object> temp = new HashMap<>(); | |
109 | + Patients p = mongoTemplate.findById(bloodPressure.getParentId(), Patients.class); | |
110 | + temp.put("id", bloodPressure.getId()); | |
111 | + if(p != null) { | |
112 | + temp.put("username", p.getUsername()); | |
113 | + temp.put("age", DateUtil.getAge(p.getBirth())); | |
114 | + temp.put("week", DateUtil.getWeekDesc(p.getLastMenses(), new Date())); | |
115 | + temp.put("riskLevel", mongoUtil.getRiskLevels(p)); //高危等级(颜色) | |
116 | + temp.put("riskFactor", mongoUtil.getRiskFactor(p)); // 高危因素 | |
117 | + temp.put("dueDate", DateUtil.getyyyy_MM_dd(p.getDueDate())); | |
118 | + temp.put("bloodPressure", bloodPressure.getSsy() + "/" + bloodPressure.getSzy() + "mmHg"); | |
119 | + temp.put("pulse", bloodPressure.getPulse()); | |
120 | + temp.put("status", getPulseStatus(bloodPressure.getSsy(), bloodPressure.getSzy())); | |
121 | + temp.put("vcCardNo", p.getVcCardNo()); | |
122 | + temp.put("pcerteTypeId", p.getPcerteTypeId()); | |
123 | + temp.put("cardNo", p.getCardNo()); | |
124 | + } | |
125 | + restList.add(temp); | |
126 | + } | |
127 | + pageResult.setGrid(restList); | |
128 | + return RespBuilder.buildSuccess(pageResult); | |
129 | + } | |
130 | + | |
131 | + @Override | |
132 | + public BaseResponse info(String id) { | |
133 | + BloodPressure bloodPressure = mongoTemplate.findById(id, BloodPressure.class); | |
134 | + List<Map<String, Object>> xyInfos = new ArrayList<>(); | |
135 | + List<Map<String, List<Object>>> lines = new ArrayList<>(); | |
136 | + List<Integer> szyMin = Arrays.asList( 60, 60, 60, 60, 60, 60); | |
137 | + List<Integer> ssyMax = Arrays.asList(140, 140, 140, 140, 140, 140); | |
138 | + List<Object> ssy = new ArrayList<>(); | |
139 | + List<Object> szy = new ArrayList<>(); | |
140 | + List<Integer> pulse = new ArrayList<>(); | |
141 | + List<String> xAxis = new ArrayList<>(); | |
142 | + if(bloodPressure != null) { | |
143 | + List<String> betweenDay = DateUtil.getBetweenDay(7); | |
144 | + Map<String, Map<String, Object>> infos = bloodPressure.getInfos(); | |
145 | + for (String date : betweenDay) { | |
146 | + Map<String, Object> temp = new HashMap<>(); | |
147 | + xyInfos.add(temp); | |
148 | + | |
149 | + temp.put("date", date); | |
150 | + temp.put("ssy", infos.containsKey(date) ? infos.get(date).get("ssy") : "--"); | |
151 | + temp.put("szy", infos.containsKey(date) ? infos.get(date).get("szy") : "--"); | |
152 | + | |
153 | + xAxis.add(date.replace("-", "/")); | |
154 | + ssy.add(infos.containsKey(date) ? infos.get(date).get("ssy") : 0); | |
155 | + szy.add(infos.containsKey(date) ? infos.get(date).get("szy") : 0); | |
156 | + pulse.add(infos.containsKey(date) ? (Integer) infos.get(date).get("pulse") : 0); | |
157 | + } | |
158 | + } | |
159 | + | |
160 | + return RespBuilder.buildSuccess("xyInfos", xyInfos, "szyMin", szyMin, "ssyMax", ssyMax, "ssy", ssy, "szy", szy, pulse); | |
161 | + } | |
162 | + | |
163 | + private String getPulseStatus(String ssy, String szy) { | |
164 | + String status = ""; | |
165 | + if(StringUtils.isNotEmpty(ssy) && StringUtils.isNotEmpty(szy)) { | |
166 | + if(Double.parseDouble(ssy) < 90 || Double.parseDouble(szy) < 60) { | |
167 | + status = "低血压"; | |
168 | + } else if(Double.parseDouble(ssy) > 140 || Double.parseDouble(szy) < 90) { | |
169 | + status = "高血压"; | |
170 | + } else { | |
171 | + status = "正常"; | |
172 | + } | |
173 | + } | |
174 | + return status; | |
175 | + } | |
176 | + | |
177 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MongoUtil.java
View file @
70beb2c
1 | 1 | package com.lyms.platform.operate.web.utils; |
2 | 2 | |
3 | +import com.alibaba.fastjson.JSONArray; | |
3 | 4 | import com.lyms.platform.biz.service.BabyBookbuildingService; |
5 | +import com.lyms.platform.biz.service.PatientsService; | |
4 | 6 | import com.lyms.platform.common.enums.RiskDefaultTypeEnum; |
5 | 7 | import com.lyms.platform.common.utils.DateUtil; |
8 | +import com.lyms.platform.common.utils.JsonUtil; | |
6 | 9 | import com.lyms.platform.common.utils.StringUtils; |
7 | 10 | import com.lyms.platform.operate.web.facade.AccessPermissionFacade; |
8 | 11 | import com.lyms.platform.operate.web.facade.AutoMatchFacade; |
... | ... | @@ -51,6 +54,9 @@ |
51 | 54 | @Autowired |
52 | 55 | private CouponMapper couponMapper; |
53 | 56 | |
57 | + @Autowired | |
58 | + private PatientsService patientsService; | |
59 | + | |
54 | 60 | public void setIdNames(List<BasicConfig> basicConfigs, List<Map<String, Object>> restList) { |
55 | 61 | for (BasicConfig config : basicConfigs) { |
56 | 62 | Map<String, Object> temp = new HashMap<>(); |
... | ... | @@ -520,5 +526,61 @@ |
520 | 526 | } |
521 | 527 | return restList; |
522 | 528 | } |
529 | + | |
530 | + /** | |
531 | + * 隐藏建档 | |
532 | + */ | |
533 | + public String doHidePatient(String parentId, String hospitalId) { | |
534 | + Patients patients = mongoTemplate.findById(parentId, Patients.class); | |
535 | + if(patients != null && !hospitalId.equals(patients.getHospitalId())) { | |
536 | + patients.setId(null); | |
537 | + patients.setHospitalId(hospitalId); | |
538 | + patients.setEnable("2"); | |
539 | + patients.setSource(patients.getId()); | |
540 | + patients.setCreated(new Date()); | |
541 | + patientsService.addPatient(patients); | |
542 | + } | |
543 | + return patients.getId(); | |
544 | + } | |
545 | + | |
546 | + /** | |
547 | + * 获取高危等级(颜色) | |
548 | + */ | |
549 | + public List<String> getRiskLevels(Patients p) { | |
550 | + List<String> colors = new ArrayList<>(); | |
551 | + if (p != null && StringUtils.isNotEmpty(p.getRiskLevelId())) { | |
552 | + List<String> ids = JsonUtil.jkstr2Obj(p.getRiskLevelId(), List.class); | |
553 | + if(CollectionUtils.isNotEmpty(ids)) { | |
554 | + for (String id : ids) { | |
555 | + String name = findName(id); | |
556 | + if(StringUtils.isNotEmpty(name)) { | |
557 | + colors.add( "risk_" + RiskDefaultTypeEnum.getColor(name)); | |
558 | + } | |
559 | + } | |
560 | + } | |
561 | + } | |
562 | + return colors; | |
563 | + } | |
564 | + | |
565 | + /** | |
566 | + * 获取高危因素 | |
567 | + */ | |
568 | + public String getRiskFactor(Patients p) { | |
569 | + StringBuilder sb = new StringBuilder(); | |
570 | + if (p != null && CollectionUtils.isNotEmpty(p.getRiskFactorId())) { | |
571 | + List<String> ids = p.getRiskFactorId(); | |
572 | + if(CollectionUtils.isNotEmpty(ids)) { | |
573 | + for (String id : ids) { | |
574 | + String name = findName(id); | |
575 | + if(StringUtils.isNotEmpty(name)) { | |
576 | + sb.append(name); | |
577 | + } | |
578 | + } | |
579 | + } | |
580 | + } | |
581 | + return sb.length() > 0 ? sb.substring(0, sb.length() - 1).toString() : sb.toString(); | |
582 | + } | |
583 | + | |
584 | + | |
523 | 585 | } |