Commit 6ec86a6437afd65729c4c0c118720d9a54ffcb9a
1 parent
7a8332f621
Exists in
master
and in
1 other branch
update
Showing 9 changed files with 828 additions and 1 deletions
- platform-common/src/main/java/com/lyms/platform/common/enums/TrackDownDateEnums.java
- platform-dal/src/main/java/com/lyms/platform/pojo/TzycTrackDown.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyStatisticsController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TrackDownController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyStatisticsFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/TrackDownFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BabyStatisticsQueryRequest.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/ITrackDownService.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/TrackDownServiceImpl.java
platform-common/src/main/java/com/lyms/platform/common/enums/TrackDownDateEnums.java
View file @
6ec86a6
platform-dal/src/main/java/com/lyms/platform/pojo/TzycTrackDown.java
View file @
6ec86a6
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_tzyc_track_down") | |
13 | +public class TzycTrackDown extends BaseModel { | |
14 | + | |
15 | + private static final long serialVersionUID = SerialIdEnum.TrackDown.getCid(); | |
16 | + | |
17 | + /** | |
18 | + * 追访ID 与下面一样 | |
19 | + */ | |
20 | + private String id; | |
21 | + | |
22 | + /** | |
23 | + * 追访ID | |
24 | + */ | |
25 | + private String trackDownRecId; | |
26 | + | |
27 | + private String parentId; | |
28 | + | |
29 | + /** | |
30 | + * 居民健康档案(妇女健康 )模型Id ResidentsArchiveModel | |
31 | + */ | |
32 | + private String residentsArchiveId; | |
33 | + | |
34 | + private String pid; | |
35 | + | |
36 | + private Date created; | |
37 | + | |
38 | + private Date modified; | |
39 | + | |
40 | + private Integer yn; | |
41 | + | |
42 | + private Integer operaterId; | |
43 | + | |
44 | + private String hospitalId; | |
45 | + | |
46 | + /** | |
47 | + * 追访时间 | |
48 | + */ | |
49 | + private Date trackDownDate; | |
50 | + | |
51 | + /** | |
52 | + * 追访人(前端直接传入的string 返回也返回string) | |
53 | + */ | |
54 | + private String trackDownUserId; | |
55 | + | |
56 | + /** | |
57 | + * 追访方式 电话、上门 | |
58 | + */ | |
59 | + private Integer trackDownType; | |
60 | + | |
61 | + /** | |
62 | + * 是否预约 | |
63 | + */ | |
64 | + private boolean isReservat; | |
65 | + | |
66 | + /** | |
67 | + * 预约时间 | |
68 | + */ | |
69 | + private Date reservatDate; | |
70 | + | |
71 | + /** | |
72 | + * 追访结果 | |
73 | + */ | |
74 | + private String result; | |
75 | + | |
76 | + /** | |
77 | + * 追访转接 是否流转 1-当前流程 2-流转至下一流程 3-停止所有流程 | |
78 | + */ | |
79 | + private Integer trackDownTransfer; | |
80 | + | |
81 | + /** | |
82 | + * 追访数据保存的类型 | |
83 | + */ | |
84 | + private Integer trackDownDateType; | |
85 | + | |
86 | + | |
87 | + public String getTrackDownRecId() { | |
88 | + return trackDownRecId; | |
89 | + } | |
90 | + | |
91 | + public void setTrackDownRecId(String trackDownRecId) { | |
92 | + this.trackDownRecId = trackDownRecId; | |
93 | + } | |
94 | + | |
95 | + public String getResidentsArchiveId() { | |
96 | + return residentsArchiveId; | |
97 | + } | |
98 | + | |
99 | + public void setResidentsArchiveId(String residentsArchiveId) { | |
100 | + this.residentsArchiveId = residentsArchiveId; | |
101 | + } | |
102 | + | |
103 | + public String getId() { | |
104 | + return id; | |
105 | + } | |
106 | + | |
107 | + public void setId(String id) { | |
108 | + this.id = id; | |
109 | + } | |
110 | + | |
111 | + public String getParentId() { | |
112 | + return parentId; | |
113 | + } | |
114 | + | |
115 | + public void setParentId(String parentId) { | |
116 | + this.parentId = parentId; | |
117 | + } | |
118 | + | |
119 | + public String getPid() { | |
120 | + return pid; | |
121 | + } | |
122 | + | |
123 | + public void setPid(String pid) { | |
124 | + this.pid = pid; | |
125 | + } | |
126 | + | |
127 | + public Date getCreated() { | |
128 | + return created; | |
129 | + } | |
130 | + | |
131 | + public void setCreated(Date created) { | |
132 | + this.created = created; | |
133 | + } | |
134 | + | |
135 | + public Date getModified() { | |
136 | + return modified; | |
137 | + } | |
138 | + | |
139 | + public void setModified(Date modified) { | |
140 | + this.modified = modified; | |
141 | + } | |
142 | + | |
143 | + public Integer getYn() { | |
144 | + return yn; | |
145 | + } | |
146 | + | |
147 | + public void setYn(Integer yn) { | |
148 | + this.yn = yn; | |
149 | + } | |
150 | + | |
151 | + public Integer getOperaterId() { | |
152 | + return operaterId; | |
153 | + } | |
154 | + | |
155 | + public void setOperaterId(Integer operaterId) { | |
156 | + this.operaterId = operaterId; | |
157 | + } | |
158 | + | |
159 | + public String getHospitalId() { | |
160 | + return hospitalId; | |
161 | + } | |
162 | + | |
163 | + public void setHospitalId(String hospitalId) { | |
164 | + this.hospitalId = hospitalId; | |
165 | + } | |
166 | + | |
167 | + public Date getTrackDownDate() { | |
168 | + return trackDownDate; | |
169 | + } | |
170 | + | |
171 | + public void setTrackDownDate(Date trackDownDate) { | |
172 | + this.trackDownDate = trackDownDate; | |
173 | + } | |
174 | + | |
175 | + public String getTrackDownUserId() { | |
176 | + return trackDownUserId; | |
177 | + } | |
178 | + | |
179 | + public void setTrackDownUserId(String trackDownUserId) { | |
180 | + this.trackDownUserId = trackDownUserId; | |
181 | + } | |
182 | + | |
183 | + public Integer getTrackDownType() { | |
184 | + return trackDownType; | |
185 | + } | |
186 | + | |
187 | + public void setTrackDownType(Integer trackDownType) { | |
188 | + this.trackDownType = trackDownType; | |
189 | + } | |
190 | + | |
191 | + public boolean isReservat() { | |
192 | + return isReservat; | |
193 | + } | |
194 | + | |
195 | + public void setReservat(boolean reservat) { | |
196 | + isReservat = reservat; | |
197 | + } | |
198 | + | |
199 | + public Date getReservatDate() { | |
200 | + return reservatDate; | |
201 | + } | |
202 | + | |
203 | + public void setReservatDate(Date reservatDate) { | |
204 | + this.reservatDate = reservatDate; | |
205 | + } | |
206 | + | |
207 | + public Integer getTrackDownTransfer() { | |
208 | + return trackDownTransfer; | |
209 | + } | |
210 | + | |
211 | + public void setTrackDownTransfer(Integer trackDownTransfer) { | |
212 | + this.trackDownTransfer = trackDownTransfer; | |
213 | + } | |
214 | + | |
215 | + public Integer getTrackDownDateType() { | |
216 | + return trackDownDateType; | |
217 | + } | |
218 | + | |
219 | + public void setTrackDownDateType(Integer trackDownDateType) { | |
220 | + this.trackDownDateType = trackDownDateType; | |
221 | + } | |
222 | + | |
223 | + public String getResult() { | |
224 | + return result; | |
225 | + } | |
226 | + | |
227 | + public void setResult(String result) { | |
228 | + this.result = result; | |
229 | + } | |
230 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyStatisticsController.java
View file @
6ec86a6
1 | +package com.lyms.platform.operate.web.controller; | |
2 | + | |
3 | +import com.lyms.platform.common.annotation.TokenRequired; | |
4 | +import com.lyms.platform.common.result.BaseResponse; | |
5 | +import com.lyms.platform.operate.web.facade.BabyStatisticsFacade; | |
6 | +import com.lyms.platform.operate.web.request.BabyStatisticsQueryRequest; | |
7 | +import org.springframework.beans.factory.annotation.Autowired; | |
8 | +import org.springframework.stereotype.Controller; | |
9 | +import org.springframework.web.bind.annotation.RequestBody; | |
10 | +import org.springframework.web.bind.annotation.RequestMapping; | |
11 | +import org.springframework.web.bind.annotation.RequestMethod; | |
12 | +import org.springframework.web.bind.annotation.ResponseBody; | |
13 | + | |
14 | +/** | |
15 | + * 儿保科计算公式统计查询控制类 | |
16 | + * @Author: 武涛涛 | |
17 | + * @Date: 2021/3/20 13:55 | |
18 | + */ | |
19 | +@Controller | |
20 | +@RequestMapping("/babyStatistics") | |
21 | +public class BabyStatisticsController { | |
22 | + @Autowired | |
23 | + private BabyStatisticsFacade babyStatisticsFacade; | |
24 | + | |
25 | + /** | |
26 | + 儿童统计 | |
27 | + * @Author: 武涛涛 | |
28 | + * @Date: 2021/3/20 13:55 | |
29 | + */ | |
30 | + @ResponseBody | |
31 | + @TokenRequired | |
32 | + @RequestMapping(value = "/matchpuerpera", method = RequestMethod.POST) | |
33 | + public BaseResponse matchCommunity(@RequestBody BabyStatisticsQueryRequest babyStatisticsQueryRequest) { | |
34 | + return babyStatisticsFacade.statistics(babyStatisticsQueryRequest); | |
35 | + } | |
36 | + | |
37 | + | |
38 | + | |
39 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TrackDownController.java
View file @
6ec86a6
... | ... | @@ -9,6 +9,7 @@ |
9 | 9 | import com.lyms.platform.operate.web.request.TrackDownQueryRequest; |
10 | 10 | import com.lyms.platform.operate.web.service.ITrackDownService; |
11 | 11 | import com.lyms.platform.pojo.TrackDown; |
12 | +import com.lyms.platform.pojo.TzycTrackDown; | |
12 | 13 | import org.springframework.beans.factory.annotation.Autowired; |
13 | 14 | import org.springframework.stereotype.Controller; |
14 | 15 | import org.springframework.web.bind.annotation.*; |
... | ... | @@ -41,7 +42,6 @@ |
41 | 42 | return downFacade.mother(parentId, trackType, getUserId(request)); |
42 | 43 | } |
43 | 44 | |
44 | - | |
45 | 45 | /** |
46 | 46 | * 追访概况查看追访详情 |
47 | 47 | * |
48 | 48 | |
... | ... | @@ -70,7 +70,21 @@ |
70 | 70 | return trackDownService.info(parentId, trackType, 0); |
71 | 71 | } |
72 | 72 | |
73 | + /** | |
74 | + * 体重管理 - 孕预期体重异常管理 -- 其他追访模块查看追访详情 | |
75 | + * | |
76 | + * @param parentId | |
77 | + * @param trackType 产考TrackDownDateEnums里面的值 0代表所有 | |
78 | + * @return | |
79 | + */ | |
73 | 80 | @ResponseBody |
81 | + @RequestMapping(value = "/tzyc/{parentId}/{trackType}", method = RequestMethod.GET) | |
82 | + @TokenRequired | |
83 | + public BaseResponse infoTzyc(@PathVariable String parentId, @PathVariable Integer trackType) { | |
84 | + return trackDownService.infoTzyc(parentId, trackType, 0); | |
85 | + } | |
86 | + | |
87 | + @ResponseBody | |
74 | 88 | @RequestMapping(value = "/init", method = RequestMethod.GET) |
75 | 89 | public BaseResponse init() { |
76 | 90 | return trackDownService.init(); |
... | ... | @@ -107,6 +121,20 @@ |
107 | 121 | @TokenRequired |
108 | 122 | public BaseResponse add(TrackDown trackDown, HttpServletRequest request) { |
109 | 123 | return trackDownService.add(getUserId(request), trackDown); |
124 | + } | |
125 | + | |
126 | + /** | |
127 | + * 体重管理 - 孕预期体重异常管理 添加追访详情 | |
128 | + * @param tzycTrackDown | |
129 | + * @param request | |
130 | + * @Author: 武涛涛 | |
131 | + * @Date: 2021/3/20 19:25 | |
132 | + */ | |
133 | + @ResponseBody | |
134 | + @RequestMapping(value = "/addTzyc",method = RequestMethod.POST) | |
135 | + @TokenRequired | |
136 | + public BaseResponse addTzyc(TzycTrackDown tzycTrackDown, HttpServletRequest request) { | |
137 | + return trackDownService.addTzyc(getUserId(request), tzycTrackDown); | |
110 | 138 | } |
111 | 139 | |
112 | 140 | @TokenRequired |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyStatisticsFacade.java
View file @
6ec86a6
1 | +package com.lyms.platform.operate.web.facade; | |
2 | + | |
3 | +import com.lyms.platform.biz.dal.IPatientDao; | |
4 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
5 | +import com.lyms.platform.common.enums.YnEnums; | |
6 | +import com.lyms.platform.common.result.BaseObjectResponse; | |
7 | +import com.lyms.platform.common.result.BaseResponse; | |
8 | +import com.lyms.platform.common.utils.StringUtils; | |
9 | +import com.lyms.platform.operate.web.request.BabyStatisticsQueryRequest; | |
10 | +import com.lyms.platform.operate.web.service.impl.BaseServiceImpl; | |
11 | +import com.lyms.platform.permission.model.Organization; | |
12 | +import com.lyms.platform.permission.model.OrganizationQuery; | |
13 | +import com.lyms.platform.permission.service.OrganizationService; | |
14 | +import com.lyms.platform.pojo.BabyCheckModel; | |
15 | +import com.lyms.platform.pojo.BabyModel; | |
16 | +import org.apache.commons.collections.CollectionUtils; | |
17 | +import org.slf4j.Logger; | |
18 | +import org.slf4j.LoggerFactory; | |
19 | +import org.springframework.beans.factory.annotation.Autowired; | |
20 | +import org.springframework.data.mongodb.core.MongoTemplate; | |
21 | +import org.springframework.data.mongodb.core.aggregation.Aggregation; | |
22 | +import org.springframework.data.mongodb.core.aggregation.AggregationOperation; | |
23 | +import org.springframework.data.mongodb.core.aggregation.AggregationResults; | |
24 | +import org.springframework.data.mongodb.core.query.Criteria; | |
25 | +import org.springframework.data.mongodb.core.query.Query; | |
26 | +import org.springframework.stereotype.Component; | |
27 | + | |
28 | +import java.text.DecimalFormat; | |
29 | +import java.util.*; | |
30 | + | |
31 | + | |
32 | +@Component | |
33 | +public class BabyStatisticsFacade extends BaseServiceImpl { | |
34 | + private static final Logger logger = LoggerFactory.getLogger(BabyStatisticsFacade.class); | |
35 | + // 儿童建册率分母 | |
36 | + private Long babyfm; | |
37 | + | |
38 | + @Autowired | |
39 | + private OrganizationService organizationService; | |
40 | + @Autowired | |
41 | + private MongoTemplate mongoTemplate; | |
42 | + | |
43 | + @Autowired | |
44 | + private IPatientDao iPatientDao; | |
45 | + | |
46 | + /* | |
47 | + 儿童统计: | |
48 | + 1:高危儿管理率、2:儿童建册率、3:低出生体重儿百分比、 | |
49 | + 4:3岁以下儿童系统管理率、5.1:中重度贫血率、5.2:5岁以下儿童肥胖率、6:听力确诊率、7:听力筛查率 | |
50 | + */ | |
51 | + public BaseResponse statistics(BabyStatisticsQueryRequest queryRequest) { | |
52 | + Map <String, Object> staMaps = new HashMap <>(); | |
53 | + List <String> provinceCityAreaHid = getProvinceCityAreaHid(queryRequest); | |
54 | + //1:高危儿管理率 | |
55 | + Map <String, String> gwMap = getGwMap(queryRequest, provinceCityAreaHid); | |
56 | + staMaps.put("gwMap", gwMap); | |
57 | + | |
58 | + //2:儿童建册率 | |
59 | + Map <String, String> babyMap = getBabyMap(queryRequest, provinceCityAreaHid); | |
60 | + staMaps.put("babyMap", babyMap); | |
61 | + | |
62 | + //3:低出生体重儿百分比 | |
63 | + Map <String, String> dtzMap = getDtzMap(queryRequest, provinceCityAreaHid); | |
64 | + staMaps.put("dtzMap", dtzMap); | |
65 | + | |
66 | + //5.1:中重度贫血率 | |
67 | + Map <String, String> zdpxMap = getZdpxMap(queryRequest, provinceCityAreaHid); | |
68 | + staMaps.put("zdpxMap", zdpxMap); | |
69 | + | |
70 | + //5.2:5岁以下儿童肥胖率 | |
71 | + Map <String, String> fplMap = getFplMap(queryRequest, provinceCityAreaHid); | |
72 | + staMaps.put("fplMap", fplMap); | |
73 | + | |
74 | + | |
75 | + | |
76 | + | |
77 | + | |
78 | + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(staMaps); | |
79 | + } | |
80 | + | |
81 | + /** | |
82 | + 5.2:5岁以下儿童肥胖率 | |
83 | + * @Author: 武涛涛 | |
84 | + * @Date: 2021/3/20 14:09 | |
85 | + */ | |
86 | + private Map <String, String> getFplMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) { | |
87 | + Map <String, String> map = new HashMap <>(); | |
88 | + | |
89 | + try { | |
90 | + //分子 儿保检查 - 儿保检查列表 儿保检查是6-59月龄的儿童,并且体重评价是“上”的儿童人数 | |
91 | + Criteria cz = Criteria.where("hospitalId").in(provinceCityAreaHid).and("yn").ne(YnEnums.NO.getId()) | |
92 | + .and("checkMonth").gte(6).lte(59).and("weightEvaluate").is("上"); | |
93 | + if(StringUtils.isNotEmpty(queryRequest.getTimeStart()) && StringUtils.isNotEmpty(queryRequest.getTimeEnd())){ | |
94 | + cz = cz.and("checkDate").gte(queryRequest.getTimeStart()).lte(queryRequest.getTimeEnd()); | |
95 | + } | |
96 | + Query queryZ = new Query(); | |
97 | + queryZ.addCriteria(cz); | |
98 | + System.out.println("5.2.1:5岁以下儿童肥胖率 -- 分子 "+queryZ); | |
99 | + Long countZ = mongoTemplate.count(queryZ, BabyCheckModel.class); | |
100 | + map.put("fz",countZ.toString()); | |
101 | + | |
102 | + //分母 儿保检查 - 儿保检查列表 查询时间范围内儿保检查是6-59月龄的儿童检查次数 | |
103 | + Criteria cm = Criteria.where("hospitalId").in(provinceCityAreaHid).and("yn").ne(YnEnums.NO.getId()) | |
104 | + .and("checkMonth").gte(6).lte(59); | |
105 | + if(StringUtils.isNotEmpty(queryRequest.getTimeStart()) && StringUtils.isNotEmpty(queryRequest.getTimeEnd())){ | |
106 | + cm = cm.and("checkDate").gte(queryRequest.getTimeStart()).lte(queryRequest.getTimeEnd()); | |
107 | + } | |
108 | + Query queryM = new Query(); | |
109 | + queryM.addCriteria(cm); | |
110 | + System.out.println("5.2.2:5岁以下儿童肥胖率 -- 分母 "+queryZ); | |
111 | + Long countM = mongoTemplate.count(queryM, BabyCheckModel.class); | |
112 | + map.put("fm",countM.toString()); | |
113 | + | |
114 | + //分率 | |
115 | + if(countZ !=null && countM !=null){ | |
116 | + Double fld = (double)countZ/countM * 100; | |
117 | + if(fld <=0.01 ){ | |
118 | + fld = 0.01; | |
119 | + } | |
120 | + map.put("fl", new DecimalFormat("0.00").format(fld)+"%"); | |
121 | + } | |
122 | + | |
123 | + } catch (Exception e) { | |
124 | + e.printStackTrace(); | |
125 | + } | |
126 | + return map; | |
127 | + } | |
128 | + /** | |
129 | + 5.1:中重度贫血率 | |
130 | + * @Author: 武涛涛 | |
131 | + * @Date: 2021/3/20 14:09 | |
132 | + */ | |
133 | + private Map <String, String> getZdpxMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) { | |
134 | + Map <String, String> map = new HashMap <>(); | |
135 | + | |
136 | + try { | |
137 | + //分子 儿保检查 - 儿保检查列表 儿保检查中是6-59月龄的并且血红蛋白小于90g/L的检查次数 | |
138 | + Criteria cz = Criteria.where("hospitalId").in(provinceCityAreaHid).and("yn").ne(YnEnums.NO.getId()) | |
139 | + .and("checkMonth").gte(6).lte(59).and("$where").is(String.format("function(){ var hemoglobin = this.hemoglobin; if( hemoglobin > 90){return true;}}")); | |
140 | + if(StringUtils.isNotEmpty(queryRequest.getTimeStart()) && StringUtils.isNotEmpty(queryRequest.getTimeEnd())){ | |
141 | + cz = cz.and("checkDate").gte(queryRequest.getTimeStart()).lte(queryRequest.getTimeEnd()); | |
142 | + } | |
143 | + Query queryZ = new Query(); | |
144 | + queryZ.addCriteria(cz); | |
145 | + System.out.println("5.1:中重度贫血率 -- 分子 "+queryZ); | |
146 | + Long countZ = mongoTemplate.count(queryZ, BabyCheckModel.class); | |
147 | + map.put("fz",countZ.toString()); | |
148 | + | |
149 | + //分母 | |
150 | + map.put("fm", ""); | |
151 | + | |
152 | + //分率 | |
153 | + map.put("fl", ""); | |
154 | + } catch (Exception e) { | |
155 | + e.printStackTrace(); | |
156 | + } | |
157 | + return map; | |
158 | + } | |
159 | + | |
160 | + | |
161 | + /** | |
162 | + 3 低出生体重儿百分比 | |
163 | + * @Author: 武涛涛 | |
164 | + * @Date: 2021/3/20 14:09 | |
165 | + */ | |
166 | + private Map <String, String> getDtzMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) { | |
167 | + Map <String, String> map = new HashMap <>(); | |
168 | + | |
169 | + try { | |
170 | + //分子 新生儿管理中的出生体重小于2500g的人数,不包括2500g | |
171 | + Criteria cz = Criteria.where("hospitalId").in(provinceCityAreaHid).and("buildType").is(2) | |
172 | + .and("$where").is(String.format("function(){ var babyWeight = this.babyWeight; if( babyWeight > 2.5){return true;}}")); | |
173 | + if(StringUtils.isNotEmpty(queryRequest.getTimeStart()) && StringUtils.isNotEmpty(queryRequest.getTimeEnd())){ | |
174 | + cz = cz.and("buildDate").gte(queryRequest.getTimeStart()).lte(queryRequest.getTimeEnd()); | |
175 | + } | |
176 | + Criteria criteria2z= Criteria.where("yn").is(YnEnums.YES.getId()); | |
177 | + Criteria criteria1z= Criteria.where("dataStatus").in(1).and("yn").is(YnEnums.NO.getId()); | |
178 | + cz.orOperator(criteria2z,criteria1z); | |
179 | + Query queryZ = new Query(); | |
180 | + queryZ.addCriteria(cz); | |
181 | + System.out.println("3 低出生体重儿百分比 -- 分子 "+queryZ); | |
182 | + Long countZ = mongoTemplate.count(queryZ, BabyModel.class); | |
183 | + map.put("fz",countZ.toString()); | |
184 | + | |
185 | + //分母 | |
186 | + Long countM = getBabyfm();//使用相同的儿童建册率分母 | |
187 | + map.put("fm",countM.toString()); | |
188 | + | |
189 | + //分率 | |
190 | + if(countZ !=null && countM !=null){ | |
191 | + Double fld = (double)countZ/countM * 100; | |
192 | + if(fld <=0.01 ){ | |
193 | + fld = 0.01; | |
194 | + } | |
195 | + map.put("fl", new DecimalFormat("0.00").format(fld)+"%"); | |
196 | + } | |
197 | + } catch (Exception e) { | |
198 | + e.printStackTrace(); | |
199 | + } | |
200 | + return map; | |
201 | + } | |
202 | + | |
203 | + | |
204 | + /** | |
205 | + 2 儿童建册率 | |
206 | + * @Author: 武涛涛 | |
207 | + * @Date: 2021/3/20 14:09 | |
208 | + */ | |
209 | + private Map <String, String> getBabyMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) { | |
210 | + Map <String, String> map = new HashMap <>(); | |
211 | + | |
212 | + try { | |
213 | + // 分子 区域妇幼管理 - 全部儿童管理,建档人数 | |
214 | + Criteria cz = Criteria.where("hospitalId").in(provinceCityAreaHid).and("yn").ne(YnEnums.NO.getId()) | |
215 | + .and("enable").nin(Arrays.asList("1", "2") ); | |
216 | + if(StringUtils.isNotEmpty(queryRequest.getTimeStart()) && StringUtils.isNotEmpty(queryRequest.getTimeEnd())){ | |
217 | + cz = cz.and("buildDate").gte(queryRequest.getTimeStart()).lte(queryRequest.getTimeEnd()); | |
218 | + } | |
219 | + Criteria criteria2Z= Criteria.where("buildType").is(3).and("enable").is("1"); | |
220 | + Criteria criteria1Z= Criteria.where("buildType").in(Arrays.asList(1,2)); | |
221 | + cz.orOperator(criteria2Z,criteria1Z); | |
222 | + Query queryZ = new Query(); | |
223 | + queryZ.addCriteria(cz); | |
224 | + System.out.println(queryZ); | |
225 | + System.out.println("2 儿童建册率 -- 分子 "+queryZ); | |
226 | + Long countZ = mongoTemplate.count(queryZ, BabyModel.class); | |
227 | + map.put("fz",countZ.toString() ); | |
228 | + | |
229 | + //分母 新生儿活产的人数(分娩儿童) | |
230 | + Criteria cm = Criteria.where("hospitalId").in(provinceCityAreaHid).and("buildType").is(2).and("yn").is(YnEnums.YES.getId()); | |
231 | + if(StringUtils.isNotEmpty(queryRequest.getTimeStart()) && StringUtils.isNotEmpty(queryRequest.getTimeEnd())){ | |
232 | + cm = cm.and("buildDate").gte(queryRequest.getTimeStart()).lte(queryRequest.getTimeEnd()); | |
233 | + } | |
234 | + Query queryM = new Query(); | |
235 | + queryM.addCriteria(cm); | |
236 | + System.out.println("2 儿童建册率 -- 分母 "+queryM); | |
237 | + Long countM = mongoTemplate.count(queryM, BabyModel.class); | |
238 | + setBabyfm(countM);//公共使用 | |
239 | + map.put("fm",countM.toString()); | |
240 | + | |
241 | + //分率 | |
242 | + if(countZ !=null && countM !=null){ | |
243 | + Double fld = (double)countZ/countM * 100; | |
244 | + if(fld <=0.01 ){ | |
245 | + fld = 0.01; | |
246 | + } | |
247 | + map.put("fl", new DecimalFormat("0.00").format(fld)+"%"); | |
248 | + } | |
249 | + } catch (Exception e) { | |
250 | + e.printStackTrace(); | |
251 | + } | |
252 | + return map; | |
253 | + } | |
254 | + | |
255 | + /** | |
256 | + 1 高危儿管理率 | |
257 | + * @Author: 武涛涛 | |
258 | + * @Date: 2021/3/20 14:09 | |
259 | + */ | |
260 | + private Map <String, String> getGwMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) { | |
261 | + Map <String, String> map = new HashMap <>(); | |
262 | + | |
263 | + try { | |
264 | + //分子 | |
265 | + Criteria cz = Criteria.where("hospitalId").in(provinceCityAreaHid).and("yn").ne(YnEnums.NO.getId()); | |
266 | + if(StringUtils.isNotEmpty(queryRequest.getTimeStart()) && StringUtils.isNotEmpty(queryRequest.getTimeEnd())){ | |
267 | + cz = cz.and("checkDate").gte(queryRequest.getTimeStart()).lte(queryRequest.getTimeEnd()); | |
268 | + } | |
269 | + Integer fzsize = 0; | |
270 | + Integer fmsize = 0; | |
271 | + AggregationOperation matchZ = Aggregation.match(cz); | |
272 | + AggregationOperation groupZ = Aggregation.group("buildId");//.count().as("gwegllCount"); | |
273 | + AggregationOperation fieldsZ = Aggregation.project("buildId"); | |
274 | + Aggregation aggregationZ = Aggregation.newAggregation(matchZ, groupZ, fieldsZ); | |
275 | + AggregationResults <HashMap> resultZ = this.mongoTemplate.aggregate(aggregationZ, "lyms_baby_high_ris", HashMap.class); | |
276 | + if(resultZ !=null && CollectionUtils.isNotEmpty(resultZ.getMappedResults())){ | |
277 | + fzsize = resultZ.getMappedResults().size(); | |
278 | + map.put("fz",fzsize.toString() ); | |
279 | + } | |
280 | + | |
281 | + //分母 | |
282 | + Criteria cm = Criteria.where("hospitalId").in(provinceCityAreaHid).and("yn").ne(YnEnums.NO.getId()); | |
283 | + if(StringUtils.isNotEmpty(queryRequest.getTimeStart()) && StringUtils.isNotEmpty(queryRequest.getTimeEnd())){ | |
284 | + cm = cm.and("checkDate").gte(queryRequest.getTimeStart()).lte(queryRequest.getTimeEnd()); | |
285 | + } | |
286 | + AggregationOperation matchM = Aggregation.match(cm); | |
287 | + AggregationOperation groupM = Aggregation.group("buildId");//.count().as("gwegllCount"); | |
288 | + AggregationOperation fieldsM = Aggregation.project("buildId"); | |
289 | + Aggregation aggregationM = Aggregation.newAggregation(matchM, groupM, fieldsM); | |
290 | + AggregationResults <HashMap> resultM = this.mongoTemplate.aggregate(aggregationM, "lyms_babycheck", HashMap.class); | |
291 | + if(resultM !=null && CollectionUtils.isNotEmpty(resultM.getMappedResults())){ | |
292 | + fmsize = resultM.getMappedResults().size(); | |
293 | + map.put("fm", fmsize.toString()); | |
294 | + } | |
295 | + //分率 | |
296 | + if(fmsize !=null && fzsize !=null){ | |
297 | + Double fld = (float)fzsize/fmsize * 100.00; | |
298 | + if(fld <=0.01 ){ | |
299 | + fld = 0.01; | |
300 | + } | |
301 | + map.put("fl", new DecimalFormat("0.00").format(fld)+"%"); | |
302 | + } | |
303 | + } catch (Exception e) { | |
304 | + e.printStackTrace(); | |
305 | + } | |
306 | + return map; | |
307 | + } | |
308 | + | |
309 | + | |
310 | + /** | |
311 | + * 获取省市县下对应的医院id,如果有医院id就只使用医院id | |
312 | + * | |
313 | + * @param babyStatisticsQueryRequest | |
314 | + * @Author: 武涛涛 | |
315 | + * @Date: 2021/3/20 11:18 | |
316 | + */ | |
317 | + private List <String> getProvinceCityAreaHid(BabyStatisticsQueryRequest babyStatisticsQueryRequest) { | |
318 | + List <String> hospitalList = new ArrayList <>(); | |
319 | + if (StringUtils.isNotEmpty(babyStatisticsQueryRequest.gethId())) { | |
320 | + hospitalList.add(babyStatisticsQueryRequest.gethId()); | |
321 | + } else if (StringUtils.isNotEmpty(babyStatisticsQueryRequest.getProvinceId())) { | |
322 | + OrganizationQuery organizationQuery = new OrganizationQuery(); | |
323 | + organizationQuery.setYn(YnEnums.YES.getId()); | |
324 | + organizationQuery.setProvinceId(babyStatisticsQueryRequest.getProvinceId()); | |
325 | + if (StringUtils.isNotEmpty(babyStatisticsQueryRequest.getCityId())) { | |
326 | + organizationQuery.setCityId(babyStatisticsQueryRequest.getCityId()); | |
327 | + if (StringUtils.isNotEmpty(babyStatisticsQueryRequest.getAreaId())) { | |
328 | + organizationQuery.setAreaId(babyStatisticsQueryRequest.getAreaId()); | |
329 | + } | |
330 | + } | |
331 | + List <String> orgId = new ArrayList <>(); | |
332 | + List <Organization> organizations = organizationService.queryOrganization(organizationQuery); | |
333 | + if (CollectionUtils.isNotEmpty(organizations)) { | |
334 | + for (Organization org : organizations) { | |
335 | + if (null != org.getId()) { | |
336 | + orgId.add(org.getId() + ""); | |
337 | + } | |
338 | + } | |
339 | + } | |
340 | + if (CollectionUtils.isEmpty(orgId)) { | |
341 | + hospitalList = new ArrayList <>(); | |
342 | + } else { | |
343 | + hospitalList.retainAll(orgId); | |
344 | + } | |
345 | + } | |
346 | + return hospitalList; | |
347 | + } | |
348 | + | |
349 | + public Long getBabyfm() { | |
350 | + return babyfm; | |
351 | + } | |
352 | + | |
353 | + public void setBabyfm(Long babyfm) { | |
354 | + this.babyfm = babyfm; | |
355 | + } | |
356 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/TrackDownFacade.java
View file @
6ec86a6
... | ... | @@ -1157,6 +1157,21 @@ |
1157 | 1157 | temp.put("yyzfTimeDays", days); /** 追访逾期天数 */ |
1158 | 1158 | } |
1159 | 1159 | } |
1160 | + try { | |
1161 | + Criteria criteriaTzyc = Criteria.where("yn").is(1).and("parentId").is(downRecord.getParentId()).and("trackDownDateType").is(12); | |
1162 | + TzycTrackDown tzycTrackDown = mongoTemplate.findOne(Query.query(criteriaTzyc).with(new Sort(Sort.Direction.DESC, "created")), TzycTrackDown.class); | |
1163 | + if (tzycTrackDown != null) { | |
1164 | + temp.put("tzycTrackDownTime", tzycTrackDown == null ? "--" : DateUtil.getyyyy_MM_dd(tzycTrackDown.getTrackDownDate())); // 追访时间 | |
1165 | + temp.put("tzycResult", StringUtils.isEmpty(tzycTrackDown.getResult()) ? "--" : tzycTrackDown.getResult()); // 追访结果 | |
1166 | + }else { | |
1167 | + temp.put("tzycTrackDownTime", "--"); | |
1168 | + temp.put("tzycResult", "--"); | |
1169 | + } | |
1170 | + } catch (Exception e) { | |
1171 | + e.printStackTrace(); | |
1172 | + } | |
1173 | + | |
1174 | + | |
1160 | 1175 | //如果是产前检查取预约结果 |
1161 | 1176 | //复诊 |
1162 | 1177 | AntenatalExaminationModel examinationModel = mongoTemplate.findOne(Query.query(Criteria.where("parentId").is(downRecord.getParentId())).with(new Sort(Sort.Direction.DESC, "created")), AntenatalExaminationModel.class); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BabyStatisticsQueryRequest.java
View file @
6ec86a6
1 | +package com.lyms.platform.operate.web.request; | |
2 | + | |
3 | +import com.lyms.platform.common.core.annotation.form.Form; | |
4 | + | |
5 | + | |
6 | +/** | |
7 | + * 儿保科计算公式统计查询入参类 | |
8 | + * | |
9 | + * @Author: 武涛涛 | |
10 | + * @Date: 2021/3/20 10:32 | |
11 | + */ | |
12 | +@Form | |
13 | +public class BabyStatisticsQueryRequest extends BasePageQueryRequest { | |
14 | + | |
15 | + | |
16 | + //排序的字段 | |
17 | + private String sort; | |
18 | + //排序的策略 升序/降序 | |
19 | + private String order; | |
20 | + //省份 | |
21 | + private String provinceId; | |
22 | + //城市 | |
23 | + private String cityId; | |
24 | + //区域 | |
25 | + private String areaId; | |
26 | + // 医院id | |
27 | + private String hId; | |
28 | + //日期访问 | |
29 | + private String timeStart; | |
30 | + private String timeEnd; | |
31 | + | |
32 | + | |
33 | + public String getSort() { | |
34 | + return sort; | |
35 | + } | |
36 | + | |
37 | + public void setSort(String sort) { | |
38 | + this.sort = sort; | |
39 | + } | |
40 | + | |
41 | + public String getOrder() { | |
42 | + return order; | |
43 | + } | |
44 | + | |
45 | + public void setOrder(String order) { | |
46 | + this.order = order; | |
47 | + } | |
48 | + | |
49 | + public String getProvinceId() { | |
50 | + return provinceId; | |
51 | + } | |
52 | + | |
53 | + public void setProvinceId(String provinceId) { | |
54 | + this.provinceId = provinceId; | |
55 | + } | |
56 | + | |
57 | + public String getCityId() { | |
58 | + return cityId; | |
59 | + } | |
60 | + | |
61 | + public void setCityId(String cityId) { | |
62 | + this.cityId = cityId; | |
63 | + } | |
64 | + | |
65 | + public String getAreaId() { | |
66 | + return areaId; | |
67 | + } | |
68 | + | |
69 | + public void setAreaId(String areaId) { | |
70 | + this.areaId = areaId; | |
71 | + } | |
72 | + | |
73 | + public String gethId() { | |
74 | + return hId; | |
75 | + } | |
76 | + | |
77 | + public void sethId(String hId) { | |
78 | + this.hId = hId; | |
79 | + } | |
80 | + | |
81 | + public String getTimeStart() { | |
82 | + return timeStart; | |
83 | + } | |
84 | + | |
85 | + public void setTimeStart(String timeStart) { | |
86 | + this.timeStart = timeStart; | |
87 | + } | |
88 | + | |
89 | + public String getTimeEnd() { | |
90 | + return timeEnd; | |
91 | + } | |
92 | + | |
93 | + public void setTimeEnd(String timeEnd) { | |
94 | + this.timeEnd = timeEnd; | |
95 | + } | |
96 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/ITrackDownService.java
View file @
6ec86a6
... | ... | @@ -4,6 +4,7 @@ |
4 | 4 | import com.lyms.platform.common.result.BaseResponse; |
5 | 5 | import com.lyms.platform.pojo.TrackDown; |
6 | 6 | import com.lyms.platform.pojo.TrackDownRecord; |
7 | +import com.lyms.platform.pojo.TzycTrackDown; | |
7 | 8 | |
8 | 9 | import javax.servlet.http.HttpServletResponse; |
9 | 10 | import java.util.Date; |
... | ... | @@ -13,6 +14,7 @@ |
13 | 14 | boolean addOrupdateTrackDownRecord(Integer userId, TrackDownRecord trackDownRecord); |
14 | 15 | |
15 | 16 | BaseResponse add(Integer userId, TrackDown trackDown); |
17 | + BaseResponse addTzyc(Integer userId, TzycTrackDown trackDown); | |
16 | 18 | |
17 | 19 | BaseObjectResponse list(String provinceId, String cityId, String areaId, String streetId, String key, Integer trackType, Integer page, Integer limit, Integer userId); |
18 | 20 | |
... | ... | @@ -25,6 +27,7 @@ |
25 | 27 | Integer followupStatus, String isDeliver, HttpServletResponse response, Integer encryption); |
26 | 28 | |
27 | 29 | BaseObjectResponse info(String patientId, Integer trackType, Integer buildType); |
30 | + BaseObjectResponse infoTzyc(String patientId, Integer trackType, Integer buildType); | |
28 | 31 | |
29 | 32 | BaseObjectResponse init(); |
30 | 33 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/TrackDownServiceImpl.java
View file @
6ec86a6
... | ... | @@ -953,6 +953,24 @@ |
953 | 953 | updateTrackCount(trackDown.getParentId()); |
954 | 954 | return RespBuilder.buildSuccess(trackDown.getId()); |
955 | 955 | } |
956 | + /** | |
957 | + * 体重管理 - 孕预期体重异常管理 -- 新增追访详情 | |
958 | + * | |
959 | + * @param userId | |
960 | + * @param tzycTrackDown | |
961 | + * @return | |
962 | + */ | |
963 | + public BaseResponse addTzyc(Integer userId, TzycTrackDown tzycTrackDown) { | |
964 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
965 | + tzycTrackDown.setId(null); | |
966 | + tzycTrackDown.setYn(YnEnums.YES.getId()); | |
967 | + tzycTrackDown.setCreated(new Date()); | |
968 | + tzycTrackDown.setHospitalId(hospitalId); | |
969 | + tzycTrackDown.setOperaterId(userId); | |
970 | + tzycTrackDown.setModified(new Date()); | |
971 | + mongoTemplate.insert(tzycTrackDown); | |
972 | + return RespBuilder.buildSuccess(tzycTrackDown.getId()); | |
973 | + } | |
956 | 974 | |
957 | 975 | |
958 | 976 | /** |
... | ... | @@ -1242,6 +1260,47 @@ |
1242 | 1260 | } |
1243 | 1261 | return RespBuilder.buildSuccess(tabList); |
1244 | 1262 | } |
1263 | + } | |
1264 | + @Override | |
1265 | + public BaseObjectResponse infoTzyc(String patientId, Integer trackType, Integer buildType) { | |
1266 | + List<Map<String, Object>> tabList = new ArrayList<>(); | |
1267 | + | |
1268 | + Criteria criteria = Criteria.where("parentId").is(patientId).and("yn").is(1); | |
1269 | + | |
1270 | + if (TrackDownDateEnums.C.getId() == trackType) { | |
1271 | + criteria.and("trackDownDateType").in(3, 9); | |
1272 | + } else if (TrackDownDateEnums.D.getId() == trackType) { | |
1273 | + criteria.and("trackDownDateType").in(4, 8); | |
1274 | + } else if (TrackDownDateEnums.F.getId() == trackType) { | |
1275 | + criteria.and("trackDownDateType").in(6, 11); | |
1276 | + } else if (TrackDownDateEnums.G.getId() == trackType) { | |
1277 | + criteria.and("trackDownDateType").in(7, 10); | |
1278 | + } else { | |
1279 | + criteria.and("trackDownDateType").in(trackType); | |
1280 | + } | |
1281 | + List<TzycTrackDown> tzycTrackDowns = mongoTemplate.find(Query.query(criteria).with(new Sort(Sort.Direction.DESC, "created")), TzycTrackDown.class); | |
1282 | + | |
1283 | + for (TzycTrackDown tzycTrackDown : tzycTrackDowns) { | |
1284 | + Map<String, Object> temp = new HashMap<>(); | |
1285 | + temp.put("trackDownDate", tzycTrackDown.getTrackDownDate() == null ? "--" : DateUtil.getyyyy_MM_dd(tzycTrackDown.getTrackDownDate())); | |
1286 | + temp.put("trackDownUser", StringUtils.isEmpty(tzycTrackDown.getTrackDownUserId()) ? "--" : tzycTrackDown.getTrackDownUserId()); | |
1287 | + if (tzycTrackDown.getTrackDownType() == TrackDownDateEnums.H.getId()) { | |
1288 | + tzycTrackDown.setTrackDownType(4); | |
1289 | + } else if (tzycTrackDown.getTrackDownType() == TrackDownDateEnums.I.getId()) { | |
1290 | + tzycTrackDown.setTrackDownType(3); | |
1291 | + } else if (tzycTrackDown.getTrackDownType() == TrackDownDateEnums.J.getId()) { | |
1292 | + tzycTrackDown.setTrackDownType(7); | |
1293 | + } else if (tzycTrackDown.getTrackDownType() == TrackDownDateEnums.K.getId()) { | |
1294 | + tzycTrackDown.setTrackDownType(6); | |
1295 | + } | |
1296 | + | |
1297 | + temp.put("trackDownType", TrackDownTypeEnums.getName(tzycTrackDown.getTrackDownType())); | |
1298 | + temp.put("result", StringUtils.isEmpty(tzycTrackDown.getResult()) ? "--" : tzycTrackDown.getResult()); | |
1299 | + temp.put("reservatDate", tzycTrackDown.getReservatDate() == null ? "--" : DateUtil.getyyyy_MM_dd(tzycTrackDown.getReservatDate())); | |
1300 | + tabList.add(temp); | |
1301 | + } | |
1302 | + return RespBuilder.buildSuccess(tabList); | |
1303 | + | |
1245 | 1304 | } |
1246 | 1305 | |
1247 | 1306 | @Override |