Commit bc0b0873fbac7c5d28e01f9da3b4ce748b5e8d7e
1 parent
c4cbc1ad9d
Exists in
master
and in
6 other branches
1河北省0-6岁儿童保健系统管理登记表 2 0-6岁儿童视觉健康档案
Showing 3 changed files with 782 additions and 0 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyHealthController.java
View file @
bc0b087
1 | +package com.lyms.platform.operate.web.controller; | |
2 | + | |
3 | + | |
4 | +import com.lyms.platform.common.annotation.TokenRequired; | |
5 | +import com.lyms.platform.common.base.BaseController; | |
6 | +import com.lyms.platform.common.base.LoginContext; | |
7 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
8 | +import com.lyms.platform.common.dao.BaseQuery; | |
9 | +import com.lyms.platform.common.enums.QhdBabyPsychologyEnums; | |
10 | +import com.lyms.platform.common.result.BaseObjectResponse; | |
11 | +import com.lyms.platform.common.result.BaseResponse; | |
12 | +import com.lyms.platform.common.result.RespBuilder; | |
13 | +import com.lyms.platform.common.utils.StringUtils; | |
14 | +import com.lyms.platform.operate.web.facade.AutoMatchFacade; | |
15 | +import com.lyms.platform.operate.web.facade.BabyCheckFacade; | |
16 | +import com.lyms.platform.operate.web.facade.BabyHealthFacade; | |
17 | +import com.lyms.platform.operate.web.request.*; | |
18 | +import com.lyms.platform.operate.web.service.INewbornVisitService; | |
19 | +import com.lyms.platform.operate.web.service.PatientWeightService; | |
20 | +import com.lyms.platform.permission.service.CouponService; | |
21 | +import org.springframework.beans.factory.annotation.Autowired; | |
22 | +import org.springframework.stereotype.Controller; | |
23 | +import org.springframework.web.bind.annotation.*; | |
24 | + | |
25 | +import javax.servlet.http.HttpServletRequest; | |
26 | +import javax.servlet.http.HttpServletResponse; | |
27 | +import javax.validation.Valid; | |
28 | + | |
29 | + | |
30 | +/** | |
31 | + * 儿保检查 | |
32 | + */ | |
33 | +@Controller | |
34 | +public class BabyHealthController extends BaseController { | |
35 | + | |
36 | + | |
37 | + @Autowired | |
38 | + private BabyHealthFacade babyHealthFacade; | |
39 | + @Autowired | |
40 | + private PatientWeightService patientWeightService; | |
41 | + @Autowired | |
42 | + private AutoMatchFacade autoMatchFacade; | |
43 | + | |
44 | + @Autowired | |
45 | + private CouponService couponService; | |
46 | + | |
47 | + /** | |
48 | + * 河北省0-6岁儿童保健系统管理登记表 | |
49 | + * @param checkTime | |
50 | + * @param queryNo | |
51 | + * @param startCheckMonthAge | |
52 | + * @param endCheckMonthAge | |
53 | + * @param nextDate | |
54 | + * @param highRisk | |
55 | + * @param waskSon | |
56 | + * @param checkDoctorId | |
57 | + * @param level | |
58 | + * @param page | |
59 | + * @param limit | |
60 | + * @param request | |
61 | + * @return | |
62 | + */ | |
63 | + @RequestMapping(value = "/queryBabyHealthStat", method = RequestMethod.GET) | |
64 | + @ResponseBody | |
65 | + @TokenRequired | |
66 | + public BaseResponse queryBabyHealthStat( | |
67 | + @RequestParam(value = "checkTime", required = false) String checkTime, | |
68 | + @RequestParam(value = "queryNo", required = false) String queryNo, | |
69 | + @RequestParam(value = "startMonthAge", required = false) Integer startCheckMonthAge, | |
70 | + @RequestParam(value = "endMonthAge", required = false) Integer endCheckMonthAge, | |
71 | + @RequestParam(value = "nextDate", required = false) String nextDate, | |
72 | + @RequestParam(value = "highRisk", required = false) Integer highRisk, | |
73 | + @RequestParam(value = "waskSon", required = false) Integer waskSon, | |
74 | + @RequestParam(value = "checkDoctorId", required = false) String checkDoctorId, | |
75 | + @RequestParam(value = "level", required = false) String level, | |
76 | + Integer page, Integer limit, HttpServletRequest request) { | |
77 | + return babyHealthFacade.babystatList(checkTime, queryNo, startCheckMonthAge, endCheckMonthAge, | |
78 | + nextDate, highRisk, waskSon, checkDoctorId, page, limit, getUserId(request), level); | |
79 | + } | |
80 | + | |
81 | + @RequestMapping(value = "/queryBabyHealthStatReport", method = RequestMethod.GET) | |
82 | + @ResponseBody | |
83 | + @TokenRequired | |
84 | + public void queryBabyHealthStatReport( | |
85 | + @RequestParam(value = "checkTime", required = false) String checkTime, | |
86 | + @RequestParam(value = "queryNo", required = false) String queryNo, | |
87 | + @RequestParam(value = "startMonthAge", required = false) Integer startCheckMonthAge, | |
88 | + @RequestParam(value = "endMonthAge", required = false) Integer endCheckMonthAge, | |
89 | + @RequestParam(value = "nextDate", required = false) String nextDate, | |
90 | + @RequestParam(value = "highRisk", required = false) Integer highRisk, | |
91 | + @RequestParam(value = "waskSon", required = false) Integer waskSon, | |
92 | + @RequestParam(value = "checkDoctorId", required = false) String checkDoctorId, | |
93 | + @RequestParam(value = "level", required = false) String level, | |
94 | + Integer page, Integer limit, HttpServletRequest request, HttpServletResponse response) { | |
95 | + BaseResponse baseResponse=babyHealthFacade.babystatListReport(checkTime, queryNo, startCheckMonthAge, endCheckMonthAge, | |
96 | + nextDate, highRisk, waskSon, checkDoctorId, page, limit, getUserId(request), level,response); | |
97 | + System.out.println(baseResponse); | |
98 | + } | |
99 | + | |
100 | + /** | |
101 | + * 0-6岁儿童视觉健康档案 统计 | |
102 | + * @param id | |
103 | + * @param request | |
104 | + * @return | |
105 | + */ | |
106 | + @ResponseBody | |
107 | + @TokenRequired | |
108 | + @RequestMapping(value = "/baby/eye/check/queryLst/{id}", method = RequestMethod.GET) | |
109 | + public BaseResponse query(@PathVariable String id, HttpServletRequest request) { | |
110 | + return babyHealthFacade.query(getUserId(request), id); | |
111 | + } | |
112 | + | |
113 | + /** | |
114 | + * 儿童健康检查记录表 | |
115 | + * @param id | |
116 | + * @param checkMonthAge | |
117 | + * @return | |
118 | + */ | |
119 | + @ResponseBody | |
120 | + @TokenRequired | |
121 | + @RequestMapping(value = "/baby/check/chkRecordLst", method = RequestMethod.GET) | |
122 | + public BaseResponse chkRecordLst(@RequestParam(value = "id", required = false) String id, | |
123 | + @RequestParam(value = "monthAge", required = false) Integer checkMonthAge, HttpServletRequest request) { | |
124 | + return babyHealthFacade.chkRecordLst(id,checkMonthAge); | |
125 | + } | |
126 | + | |
127 | + | |
128 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyHealthFacade.java
View file @
bc0b087
1 | +package com.lyms.platform.operate.web.facade; | |
2 | + | |
3 | +import com.lyms.hospitalapi.qhdfy.QhdfyHisService; | |
4 | +import com.lyms.platform.beans.MsgRequest; | |
5 | +import com.lyms.platform.biz.service.*; | |
6 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
7 | +import com.lyms.platform.common.dao.BaseQuery; | |
8 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
9 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
10 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
11 | +import com.lyms.platform.common.enums.*; | |
12 | +import com.lyms.platform.common.result.*; | |
13 | +import com.lyms.platform.common.utils.*; | |
14 | +import com.lyms.platform.operate.web.request.*; | |
15 | +import com.lyms.platform.operate.web.result.*; | |
16 | +import com.lyms.platform.operate.web.service.BabyAfterVisitService; | |
17 | +import com.lyms.platform.operate.web.service.INewbornVisitService; | |
18 | +import com.lyms.platform.operate.web.service.PatientWeightService; | |
19 | +import com.lyms.platform.operate.web.service.impl.BaseServiceImpl; | |
20 | +import com.lyms.platform.operate.web.utils.CollectionUtils; | |
21 | +import com.lyms.platform.operate.web.utils.MongoUtil; | |
22 | +import com.lyms.platform.permission.dao.master.CouponMapper; | |
23 | +import com.lyms.platform.permission.model.CheckItem; | |
24 | +import com.lyms.platform.permission.model.Organization; | |
25 | +import com.lyms.platform.permission.model.PatientService; | |
26 | +import com.lyms.platform.permission.model.Users; | |
27 | +import com.lyms.platform.permission.service.*; | |
28 | +import com.lyms.platform.pojo.*; | |
29 | +import com.lyms.platform.query.*; | |
30 | +import com.mongodb.BasicDBObject; | |
31 | +import javafx.beans.binding.ObjectExpression; | |
32 | +import jxl.Workbook; | |
33 | +import jxl.format.VerticalAlignment; | |
34 | +import jxl.write.Label; | |
35 | +import jxl.write.WritableCellFormat; | |
36 | +import jxl.write.WritableSheet; | |
37 | +import jxl.write.WritableWorkbook; | |
38 | +import org.springframework.beans.factory.annotation.Autowired; | |
39 | +import org.springframework.beans.factory.annotation.Qualifier; | |
40 | +import org.springframework.data.domain.Sort; | |
41 | +import org.springframework.data.mongodb.core.MongoTemplate; | |
42 | +import org.springframework.data.mongodb.core.aggregation.Aggregation; | |
43 | +import org.springframework.data.mongodb.core.aggregation.AggregationResults; | |
44 | +import org.springframework.data.mongodb.core.query.Criteria; | |
45 | +import org.springframework.data.mongodb.core.query.Query; | |
46 | +import org.springframework.data.mongodb.core.query.Update; | |
47 | +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | |
48 | +import org.springframework.stereotype.Component; | |
49 | +import org.springframework.web.util.WebUtils; | |
50 | + | |
51 | +import javax.servlet.http.HttpServletResponse; | |
52 | +import java.io.File; | |
53 | +import java.io.FileInputStream; | |
54 | +import java.io.InputStream; | |
55 | +import java.util.*; | |
56 | +import java.util.concurrent.Callable; | |
57 | +import java.util.concurrent.Future; | |
58 | +import java.util.regex.Pattern; | |
59 | + | |
60 | +import static com.lyms.platform.operate.web.service.BabyAfterVisitService.*; | |
61 | + | |
62 | +@Component | |
63 | +public class BabyHealthFacade extends BaseServiceImpl { | |
64 | + //滦平高危同步地址 | |
65 | + public static final String LP_RISK_URL = PropertiesUtils.getPropertyValue("lp_risk_url"); | |
66 | + @Autowired | |
67 | + private BabyCheckService babyCheckService; | |
68 | + @Autowired | |
69 | + private BabyAutoDiagnoseRiskFacade babyAutoDiagnoseRiskFacade; | |
70 | + @Autowired | |
71 | + private BabyDepartmentReferralFacade babyDepartmentReferralFacade; | |
72 | + @Autowired | |
73 | + private BabyBookbuildingService babyBookbuildingService; | |
74 | + @Autowired | |
75 | + private PatientWeightService patientWeightService; | |
76 | + @Autowired | |
77 | + private BabyService babyService; | |
78 | + | |
79 | + @Autowired | |
80 | + private BasicConfigFacade basicConfigFacade; | |
81 | + | |
82 | + @Autowired | |
83 | + private MongoTemplate mongoTemplate; | |
84 | + | |
85 | + | |
86 | + @Autowired | |
87 | + private BasicConfigService basicConfigService; | |
88 | + | |
89 | + @Autowired | |
90 | + private PatientsService patientsService; | |
91 | + | |
92 | + @Autowired | |
93 | + private ApplyOrderService applyOrderService; | |
94 | + | |
95 | + @Autowired | |
96 | + private UsersService usersService; | |
97 | + | |
98 | + @Autowired | |
99 | + private PersonService personService; | |
100 | + | |
101 | + | |
102 | + @Autowired | |
103 | + private OrganizationService organizationService; | |
104 | + | |
105 | + @Autowired | |
106 | + private AntenatalExaminationFacade antenatalExaminationFacade; | |
107 | + | |
108 | + @Autowired | |
109 | + private BabyBookbuildingFacade babyBookbuildingFacade; | |
110 | + @Autowired | |
111 | + private OrganizationGroupsFacade groupsFacade; | |
112 | + @Autowired | |
113 | + private AutoMatchFacade autoMatchFacade; | |
114 | + | |
115 | + @Autowired | |
116 | + private CouponService couponService; | |
117 | + | |
118 | + @Autowired | |
119 | + private QhdfyHisService qhdfyHisService; | |
120 | + | |
121 | + @Autowired | |
122 | + private CouponMapper couponMapper; | |
123 | + | |
124 | + @Autowired | |
125 | + private MongoUtil mongoUtil; | |
126 | + | |
127 | + @Autowired | |
128 | + private OperateLogFacade operateLogFacade; | |
129 | + | |
130 | + @Autowired | |
131 | + private PatientServiceService patientServiceService; | |
132 | + | |
133 | + @Autowired | |
134 | + private AreaCountFacade areaCountFacade; | |
135 | + @Autowired | |
136 | + private MeasureDataInfoService measureDataInfoService; | |
137 | + @Autowired | |
138 | + private BabyNutritionService babyNutritionService; | |
139 | + @Autowired | |
140 | + private BabyAfterVisitService babyAfterVisitService; | |
141 | + | |
142 | + @Autowired | |
143 | + private SmsConfigFacade smsConfigFacade; | |
144 | + | |
145 | + @Autowired | |
146 | + private INewbornVisitService visitService;//访视 | |
147 | + | |
148 | + | |
149 | + @Autowired | |
150 | + @Qualifier("cfCheckItemService") | |
151 | + private CheckItemService checkItemService; | |
152 | + | |
153 | + @Autowired | |
154 | + private OrganizationGroupsFacade organizationGroupsFacade; | |
155 | + | |
156 | + public static final String HIS_VERSION = PropertiesUtils.getPropertyValue("his_version"); | |
157 | + | |
158 | + | |
159 | + public BaseResponse babystatList(String checkTime, String queryNo, Integer checkMonthAge, Integer endCheckMonthAge, String nextDate, | |
160 | + Integer highRisk, Integer waskSon, String checkDoctorId, Integer page, Integer limit, Integer userId, String level) { | |
161 | + boolean flag = false; | |
162 | + // List<String> hospital = groupsFacade.findGroupHospital(userId, false); | |
163 | + int[] monthArr = {0, 3, 4, 8, 12, 18, 24, 30, 36, 48, 60, 72};//月龄 | |
164 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
165 | + Criteria criteria = Criteria.where("yn").ne(0).and("hospitalId").is(hospitalId); | |
166 | + Criteria pCriteria = Criteria.where("yn").ne(0).and("hospitalId").is(hospitalId); | |
167 | + if (org.apache.commons.lang.StringUtils.isNotBlank(queryNo)) { | |
168 | + pCriteria.orOperator(Criteria.where("mcertNo").regex(queryNo), Criteria.where("name").regex(queryNo), | |
169 | + Criteria.where("fphone").regex(queryNo), Criteria.where("vcCardNo").regex(queryNo), Criteria.where("mname").regex(queryNo)); | |
170 | + flag = true; | |
171 | + } | |
172 | + PageResult pageResult = findMongoPage(BabyModel.class, new Query(pCriteria).with(new Sort(Sort.Direction.DESC, "created")), page, limit); | |
173 | + List<BabyModel> babykModelsList = (List<BabyModel>) pageResult.getGrid(); | |
174 | + List<Map<String, Object>> grid = new ArrayList<>(); | |
175 | + | |
176 | + if (com.lyms.platform.operate.web.utils.CollectionUtils.isNotEmpty(babykModelsList)) { | |
177 | + for (BabyModel babyModel : babykModelsList) { | |
178 | + Map<String, Object> row = new HashMap<>(); | |
179 | + Map<String, Object> babyMap = new HashMap<>(); | |
180 | + babyMap.put("babyName", babyModel.getName()); | |
181 | + babyMap.put("sex", babyModel.getSex()); | |
182 | + babyMap.put("birth", babyModel.getBirth()); | |
183 | + babyMap.put("mname", babyModel.getMname()); | |
184 | + babyMap.put("address", babyModel.getAddress()); | |
185 | + babyMap.put("mphone", babyModel.getMphone()); | |
186 | + row.put("baby", babyMap); | |
187 | +// ids.add(babyModel.getId()); | |
188 | + Criteria criteriaCheck = Criteria.where("buildId").in(babyModel.getId()); | |
189 | +// pageResult = findMongoPage(BabyCheckModel.class, new Query(criteriaCheck).with(new Sort(Sort.Direction.DESC, "created")), page, limit); | |
190 | + List<BabyCheckModel> babyCheckModelList = mongoTemplate.find(new Query(criteriaCheck).with(new Sort(Sort.Direction.DESC, "created")), BabyCheckModel.class); | |
191 | + | |
192 | +// List <BabyCheckModel> babyCheckModelList = (List <BabyCheckModel>) pageResult.getGrid(); | |
193 | + | |
194 | + List<Map<String, Object>> listAge = new ArrayList<>(); | |
195 | + for (BabyCheckModel babyCheckModel : babyCheckModelList) { | |
196 | + Map<String, Object> map = new HashMap<>(); | |
197 | + String feedType = ""; | |
198 | + String feedTypeId = babyCheckModel.getFeedType(); | |
199 | + if (StringUtils.isNotEmpty(feedTypeId)) { | |
200 | + feedType = WyTypeEnums.getNameById(Integer.parseInt(feedTypeId)); | |
201 | + } | |
202 | + map.put("feedType", feedType); | |
203 | + for (int i = 0; i < monthArr.length; i++) { | |
204 | + Map<String, Object> mapAge = new HashMap<>(); | |
205 | + if (monthArr[i] == babyCheckModel.getCheckMonth().intValue()) { | |
206 | + mapAge.put("height", babyCheckModel.getHeight()); | |
207 | + mapAge.put("heightEvaluate", babyCheckModel.getHeightEvaluate()); | |
208 | + mapAge.put("weight", babyCheckModel.getWeight()); | |
209 | + mapAge.put("weightEvaluate", babyCheckModel.getWeightEvaluate()); | |
210 | + mapAge.put("hemoglobin", babyCheckModel.getHemoglobin()); | |
211 | + } else { | |
212 | + mapAge.put("height", ""); | |
213 | + mapAge.put("heightEvaluate", ""); | |
214 | + mapAge.put("weight", ""); | |
215 | + mapAge.put("weightEvaluate", ""); | |
216 | + mapAge.put("hemoglobin", ""); | |
217 | + } | |
218 | + mapAge.put("age", monthArr[i]); | |
219 | + listAge.add(mapAge); | |
220 | + } | |
221 | + | |
222 | + | |
223 | + row.put("monthChk", listAge); | |
224 | + | |
225 | + row.put("height", babyCheckModel.getHeight()); | |
226 | + row.put("weight", babyCheckModel.getWeight()); | |
227 | + //秦皇岛需求,查询最后一次检查的高危详情 | |
228 | + row.put("qhdHighRiskInfo", babyCheckModel.getQhdHighRiskInfo()); | |
229 | + } | |
230 | + | |
231 | +// 访视 | |
232 | + List<NewbornVisit> newbornVisits = mongoTemplate.find(Query.query(Criteria.where("babyId").is(babyModel.getId()).and("hospitalId").in(hospitalId).and("yn").ne("0")) | |
233 | + .with(new Sort(Sort.Direction.ASC, "checkTime")), NewbornVisit.class); | |
234 | + List<Map<String, Object>> rest = new ArrayList<>(); | |
235 | + for (NewbornVisit newbornVisit : newbornVisits) { | |
236 | + Map<String, Object> temp = new HashMap<>(); | |
237 | + temp.put("id", newbornVisit.getId()); | |
238 | + temp.put("hospitalId", newbornVisit.getHospitalId()); | |
239 | + temp.put("pid", newbornVisit.getPid()); | |
240 | + temp.put("checkTime", newbornVisit.getCheckTime() == null ? null : DateUtil.getyyyy_MM_dd(newbornVisit.getCheckTime())); | |
241 | + temp.put("checkTimeDesc", newbornVisit.getCheckTimeDesc()); | |
242 | + rest.add(temp); | |
243 | + } | |
244 | + row.put("visitcnt", newbornVisits.size()); | |
245 | + row.put("instWeight", ""); | |
246 | + if (newbornVisits.size() > 1) { | |
247 | + int size = newbornVisits.size(); | |
248 | + String wn1 = newbornVisits.get(size - 1).getWeightNow(); | |
249 | + String wn2 = newbornVisits.get(size - 2).getWeightNow(); | |
250 | + if (null == wn1) wn1 = "0"; | |
251 | + if (null == wn2) wn2 = "0"; | |
252 | + | |
253 | + row.put("instWeight", (Float.parseFloat(wn1) - Float.parseFloat(wn2))); | |
254 | + } | |
255 | + grid.add(row); | |
256 | + | |
257 | + } | |
258 | + } | |
259 | + | |
260 | + pageResult.setGrid(grid); | |
261 | + return RespBuilder.buildSuccess(pageResult); | |
262 | + | |
263 | + | |
264 | + } | |
265 | + | |
266 | + public BaseResponse babystatListReport(String checkTime, String queryNo, Integer checkMonthAge, Integer endCheckMonthAge, String nextDate, | |
267 | + Integer highRisk, Integer waskSon, String checkDoctorId, Integer page, Integer limit, Integer userId, String level, HttpServletResponse response) { | |
268 | + boolean flag = false; | |
269 | + // List<String> hospital = groupsFacade.findGroupHospital(userId, false); | |
270 | + int[] monthArr = {0, 3, 4, 8, 12, 18, 24, 30, 36, 48, 60, 72};//月龄 | |
271 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
272 | + Criteria criteria = Criteria.where("yn").ne(0).and("hospitalId").is(hospitalId); | |
273 | + Criteria pCriteria = Criteria.where("yn").ne(0).and("hospitalId").is(hospitalId); | |
274 | + if (org.apache.commons.lang.StringUtils.isNotBlank(queryNo)) { | |
275 | + pCriteria.orOperator(Criteria.where("mcertNo").regex(queryNo), Criteria.where("name").regex(queryNo), | |
276 | + Criteria.where("fphone").regex(queryNo), Criteria.where("vcCardNo").regex(queryNo), Criteria.where("mname").regex(queryNo)); | |
277 | + flag = true; | |
278 | + } | |
279 | + PageResult pageResult = new PageResult(); | |
280 | + | |
281 | + try { | |
282 | + response.setContentType("application/force-download"); | |
283 | + response.setHeader("Content-Disposition", "attachment;filename=" + new String(("年报表.xls").getBytes("UTF-8"), "ISO-8859-1")); | |
284 | + String path = this.getClass().getResource("/").getPath() + "babyhealthstat.xls"; | |
285 | + | |
286 | + // 导出excel | |
287 | + File file = new File(path); | |
288 | + InputStream in = new FileInputStream(file); | |
289 | + Workbook wb = Workbook.getWorkbook(in); | |
290 | + | |
291 | + | |
292 | + WritableWorkbook book = wb.createWorkbook(response.getOutputStream(), wb); | |
293 | + WritableSheet ws = book.getSheet(0); | |
294 | + | |
295 | + WritableCellFormat contentFormt = new WritableCellFormat(); | |
296 | + contentFormt.setAlignment(jxl.format.Alignment.CENTRE); | |
297 | + contentFormt.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); | |
298 | + contentFormt.setVerticalAlignment(VerticalAlignment.CENTRE); | |
299 | + | |
300 | + int lastPage = 0, pageSize = 0; | |
301 | + | |
302 | + pageResult = findMongoPage(BabyModel.class, new Query(pCriteria).with(new Sort(Sort.Direction.DESC, "created")), page, limit); | |
303 | +// lastPage = pageResult.getLastPage(); | |
304 | +// pageSize = pageResult.getSize(); | |
305 | +// for (int n = 0; n < lastPage; n++) { | |
306 | +// pageResult = findMongoPage(BabyModel.class, new Query(pCriteria).with(new Sort(Sort.Direction.DESC, "created")), n, pageSize); | |
307 | + List<BabyModel> babykModelsList = (List<BabyModel>) pageResult.getGrid(); | |
308 | +// PageResult pageResult=new PageResult(); | |
309 | + babykModelsList = this.mongoTemplate.find(new Query(pCriteria).with(new Sort(Sort.Direction.DESC, "created")),BabyModel.class); | |
310 | + List<Map<String, Object>> grid = new ArrayList<>(); | |
311 | + | |
312 | + if (com.lyms.platform.operate.web.utils.CollectionUtils.isNotEmpty(babykModelsList)) { | |
313 | + for (int j=0; j<babykModelsList.size();j++) { | |
314 | + BabyModel babyModel = babykModelsList.get(j); | |
315 | + Map<String, Object> row = new HashMap<>(); | |
316 | + Map<String, Object> babyMap = new HashMap<>(); | |
317 | + babyMap.put("babyName", babyModel.getName()); | |
318 | + babyMap.put("sex", babyModel.getSex()); | |
319 | + babyMap.put("birth", babyModel.getBirth()); | |
320 | + babyMap.put("mname", babyModel.getMname()); | |
321 | + babyMap.put("address", babyModel.getAddress()); | |
322 | + babyMap.put("mphone", babyModel.getMphone()); | |
323 | + row.put("baby", babyMap); | |
324 | + Criteria criteriaCheck = Criteria.where("buildId").in(babyModel.getId()); | |
325 | +// pageResult = findMongoPage(BabyCheckModel.class, new Query(criteriaCheck).with(new Sort(Sort.Direction.DESC, "created")), page, limit); | |
326 | + List<BabyCheckModel> babyCheckModelList = mongoTemplate.find(new Query(criteriaCheck).with(new Sort(Sort.Direction.DESC, "created")), BabyCheckModel.class); | |
327 | + | |
328 | + List<Map<String, Object>> listAge = new ArrayList<>(); | |
329 | + | |
330 | + for (BabyCheckModel babyCheckModel : babyCheckModelList) { | |
331 | + Map<String, Object> map = new HashMap<>(); | |
332 | + String feedType = ""; | |
333 | + String feedTypeId = babyCheckModel.getFeedType(); | |
334 | + if (StringUtils.isNotEmpty(feedTypeId)) { | |
335 | + feedType = WyTypeEnums.getNameById(Integer.parseInt(feedTypeId)); | |
336 | + } | |
337 | + map.put("feedType", feedType); | |
338 | + | |
339 | + for (int i = 0; i < monthArr.length; i++) { | |
340 | + Map<String, Object> mapAge = new HashMap<>(); | |
341 | + if (monthArr[i] == babyCheckModel.getCheckMonth().intValue()) { | |
342 | + mapAge.put("height", babyCheckModel.getHeight()); | |
343 | + mapAge.put("heightEvaluate", babyCheckModel.getHeightEvaluate()); | |
344 | + mapAge.put("weight", babyCheckModel.getWeight()); | |
345 | + mapAge.put("weightEvaluate", babyCheckModel.getWeightEvaluate()); | |
346 | + mapAge.put("hemoglobin", babyCheckModel.getHemoglobin()); | |
347 | + } else { | |
348 | + mapAge.put("height", ""); | |
349 | + mapAge.put("heightEvaluate", ""); | |
350 | + mapAge.put("weight", ""); | |
351 | + mapAge.put("weightEvaluate", ""); | |
352 | + mapAge.put("hemoglobin", ""); | |
353 | + } | |
354 | + mapAge.put("age", monthArr[i]); | |
355 | + listAge.add(mapAge); | |
356 | + } | |
357 | + | |
358 | + | |
359 | + | |
360 | + | |
361 | + | |
362 | + row.put("monthChk", listAge); | |
363 | + | |
364 | + row.put("height", babyCheckModel.getHeight()); | |
365 | + row.put("weight", babyCheckModel.getWeight()); | |
366 | + //秦皇岛需求,查询最后一次检查的高危详情 | |
367 | + row.put("qhdHighRiskInfo", babyCheckModel.getQhdHighRiskInfo()); | |
368 | + } | |
369 | + if(babyCheckModelList.size()<1){ | |
370 | + for (int i = 0; i < monthArr.length; i++) { | |
371 | + Map<String, Object> mapAge = new HashMap<>(); | |
372 | + mapAge.put("height", ""); | |
373 | + mapAge.put("heightEvaluate", ""); | |
374 | + mapAge.put("weight", ""); | |
375 | + mapAge.put("weightEvaluate", ""); | |
376 | + mapAge.put("hemoglobin", ""); | |
377 | + listAge.add(mapAge); | |
378 | + } | |
379 | + } | |
380 | + | |
381 | +// 访视 | |
382 | + List<NewbornVisit> newbornVisits = mongoTemplate.find(Query.query(Criteria.where("babyId").is(babyModel.getId()).and("hospitalId").in(hospitalId).and("yn").ne("0")) | |
383 | + .with(new Sort(Sort.Direction.ASC, "checkTime")), NewbornVisit.class); | |
384 | + List<Map<String, Object>> rest = new ArrayList<>(); | |
385 | + for (NewbornVisit newbornVisit : newbornVisits) { | |
386 | + Map<String, Object> temp = new HashMap<>(); | |
387 | + temp.put("id", newbornVisit.getId()); | |
388 | + temp.put("hospitalId", newbornVisit.getHospitalId()); | |
389 | + temp.put("pid", newbornVisit.getPid()); | |
390 | + temp.put("checkTime", newbornVisit.getCheckTime() == null ? null : DateUtil.getyyyy_MM_dd(newbornVisit.getCheckTime())); | |
391 | + temp.put("checkTimeDesc", newbornVisit.getCheckTimeDesc()); | |
392 | + rest.add(temp); | |
393 | + } | |
394 | + row.put("visitcnt", newbornVisits.size()); | |
395 | + row.put("instWeight", ""); | |
396 | + if (newbornVisits.size() > 1) { | |
397 | + int size = newbornVisits.size(); | |
398 | + String wn1 = newbornVisits.get(size - 1).getWeightNow(); | |
399 | + String wn2 = newbornVisits.get(size - 2).getWeightNow(); | |
400 | + if (null == wn1) wn1 = "0"; | |
401 | + if (null == wn2) wn2 = "0"; | |
402 | + | |
403 | + row.put("instWeight", (Float.parseFloat(wn1) - Float.parseFloat(wn2))); | |
404 | + } | |
405 | + | |
406 | +// 写入excel | |
407 | + Label label = new Label(0, j + 5, (j + 1) + ""); | |
408 | + ws.addCell(label); | |
409 | + | |
410 | + | |
411 | + label = new Label(1, j + 5, babyModel.getName(), contentFormt); | |
412 | + ws.addCell(label); | |
413 | + | |
414 | + label = new Label(2, j + 5, SexEnum.getTextById(babyModel.getSex()), contentFormt); | |
415 | + ws.addCell(label); | |
416 | + | |
417 | + label = new Label(3, j + 5, DateUtil.getyyyy_MM_dd(babyModel.getBirth()), contentFormt); | |
418 | + ws.addCell(label); | |
419 | + | |
420 | + label = new Label(4, j + 5, babyModel.getMname(), contentFormt); | |
421 | + ws.addCell(label); | |
422 | + | |
423 | + label = new Label(5, j + 5, babyModel.getAddress()==null?"":babyModel.getAddress(), contentFormt); | |
424 | + ws.addCell(label); | |
425 | +// 访视 | |
426 | + label = new Label(6, j + 5, newbornVisits.size()+"", contentFormt); | |
427 | + ws.addCell(label); | |
428 | + | |
429 | + label = new Label(7, j + 5,row.get("instWeight")+"", contentFormt); | |
430 | + ws.addCell(label); | |
431 | +// 喂养方式 | |
432 | + label = new Label(8, j + 5,row.get("feedType")==null?"":row.get("feedType")+"", contentFormt); | |
433 | + ws.addCell(label); | |
434 | + | |
435 | + // 检查情况 | |
436 | + | |
437 | +// for (int n = 0; n < listAge.size(); n++) { | |
438 | +// Map<String,Object> aRow=listAge.get(n); | |
439 | +// mapAge.put("height", ""); | |
440 | +// mapAge.put("heightEvaluate", ""); | |
441 | +// mapAge.put("weight", ""); | |
442 | +// mapAge.put("weightEvaluate", ""); | |
443 | +// mapAge.put("hemoglobin", ""); | |
444 | + | |
445 | +// label = new Label(9+n*2, j + 5,aRow.get("weight")+"/"+aRow.get("height"), contentFormt); | |
446 | +// ws.addCell(label); | |
447 | +// label = new Label(10+n*2, j + 5,aRow.get("weightEvaluate")+"/"+aRow.get("heightEvaluate"), contentFormt); | |
448 | +// ws.addCell(label); | |
449 | +// if(n==4 || n==8 || n==9 || n==10 || n== 11){ | |
450 | +// | |
451 | +// label = new Label(11+n, j + 5,aRow.get("hemoglobin")+"", contentFormt); | |
452 | +// ws.addCell(label); | |
453 | +// } | |
454 | +// } | |
455 | + | |
456 | + Map<String,Object> aRow=listAge.get(0); | |
457 | + label = new Label(9, j + 5,aRow.get("weight")+"/"+aRow.get("height"), contentFormt); | |
458 | + ws.addCell(label); | |
459 | + label = new Label(10, j + 5,aRow.get("weightEvaluate")+"/"+aRow.get("heightEvaluate"), contentFormt); | |
460 | + ws.addCell(label); | |
461 | + | |
462 | + aRow=listAge.get(1); | |
463 | + label = new Label(11, j + 5,aRow.get("weight")+"/"+aRow.get("height"), contentFormt); | |
464 | + ws.addCell(label); | |
465 | + label = new Label(12, j + 5,aRow.get("weightEvaluate")+"/"+aRow.get("heightEvaluate"), contentFormt); | |
466 | + ws.addCell(label); | |
467 | + | |
468 | + aRow=listAge.get(2); | |
469 | + label = new Label(13, j + 5,aRow.get("weight")+"/"+aRow.get("height"), contentFormt); | |
470 | + ws.addCell(label); | |
471 | + label = new Label(14, j + 5,aRow.get("weightEvaluate")+"/"+aRow.get("heightEvaluate"), contentFormt); | |
472 | + ws.addCell(label); | |
473 | + | |
474 | + aRow=listAge.get(3); | |
475 | + label = new Label(15, j + 5,aRow.get("weight")+"/"+aRow.get("height"), contentFormt); | |
476 | + ws.addCell(label); | |
477 | + label = new Label(16, j + 5,aRow.get("weightEvaluate")+"/"+aRow.get("heightEvaluate"), contentFormt); | |
478 | + ws.addCell(label); | |
479 | + | |
480 | + aRow=listAge.get(4); | |
481 | + label = new Label(17, j + 5,aRow.get("weight")+"/"+aRow.get("height"), contentFormt); | |
482 | + ws.addCell(label); | |
483 | + label = new Label(18, j + 5,aRow.get("weightEvaluate")+"/"+aRow.get("heightEvaluate"), contentFormt); | |
484 | + ws.addCell(label); | |
485 | + label = new Label(19, j + 5,aRow.get("hemoglobin")+"", contentFormt); | |
486 | + ws.addCell(label); | |
487 | + | |
488 | + aRow=listAge.get(5); | |
489 | + label = new Label(20, j + 5,aRow.get("weight")+"/"+aRow.get("height"), contentFormt); | |
490 | + ws.addCell(label); | |
491 | + label = new Label(21, j + 5,aRow.get("weightEvaluate")+"/"+aRow.get("heightEvaluate"), contentFormt); | |
492 | + ws.addCell(label); | |
493 | + | |
494 | + aRow=listAge.get(6); | |
495 | + label = new Label(22, j + 5,aRow.get("weight")+"/"+aRow.get("height"), contentFormt); | |
496 | + ws.addCell(label); | |
497 | + label = new Label(23, j + 5,aRow.get("weightEvaluate")+"/"+aRow.get("heightEvaluate"), contentFormt); | |
498 | + ws.addCell(label); | |
499 | + | |
500 | + aRow=listAge.get(7); | |
501 | + label = new Label(24, j + 5,aRow.get("weight")+"/"+aRow.get("height"), contentFormt); | |
502 | + ws.addCell(label); | |
503 | + label = new Label(25, j + 5,aRow.get("weightEvaluate")+"/"+aRow.get("heightEvaluate"), contentFormt); | |
504 | + ws.addCell(label); | |
505 | + | |
506 | + aRow=listAge.get(8); | |
507 | + label = new Label(26, j + 5,aRow.get("weight")+"/"+aRow.get("height"), contentFormt); | |
508 | + ws.addCell(label); | |
509 | + label = new Label(27, j + 5,aRow.get("weightEvaluate")+"/"+aRow.get("heightEvaluate"), contentFormt); | |
510 | + ws.addCell(label); | |
511 | + label = new Label(28, j + 5,aRow.get("hemoglobin")+"", contentFormt); | |
512 | + ws.addCell(label); | |
513 | + | |
514 | + aRow=listAge.get(9); | |
515 | + label = new Label(29, j + 5,aRow.get("weight")+"/"+aRow.get("height"), contentFormt); | |
516 | + ws.addCell(label); | |
517 | + label = new Label(30, j + 5,aRow.get("weightEvaluate")+"/"+aRow.get("heightEvaluate"), contentFormt); | |
518 | + ws.addCell(label); | |
519 | + label = new Label(31, j + 5,aRow.get("hemoglobin")+"", contentFormt); | |
520 | + ws.addCell(label); | |
521 | + | |
522 | + aRow=listAge.get(10); | |
523 | + label = new Label(32, j + 5,aRow.get("weight")+"/"+aRow.get("height"), contentFormt); | |
524 | + ws.addCell(label); | |
525 | + label = new Label(33, j + 5,aRow.get("weightEvaluate")+"/"+aRow.get("heightEvaluate"), contentFormt); | |
526 | + ws.addCell(label); | |
527 | + label = new Label(34, j + 5,aRow.get("hemoglobin")+"", contentFormt); | |
528 | + ws.addCell(label); | |
529 | + | |
530 | + aRow=listAge.get(11); | |
531 | + label = new Label(35, j + 5,aRow.get("weight")+"/"+aRow.get("height"), contentFormt); | |
532 | + ws.addCell(label); | |
533 | + label = new Label(36, j + 5,aRow.get("weightEvaluate")+"/"+aRow.get("heightEvaluate"), contentFormt); | |
534 | + ws.addCell(label); | |
535 | + label = new Label(37, j + 5,aRow.get("hemoglobin")+"", contentFormt); | |
536 | + ws.addCell(label); | |
537 | + | |
538 | + | |
539 | + label = new Label(38, j + 5,babyModel.getMphone(), contentFormt); | |
540 | + ws.addCell(label); | |
541 | + | |
542 | + } | |
543 | + | |
544 | + } | |
545 | + | |
546 | +// } | |
547 | + | |
548 | + | |
549 | + book.write(); | |
550 | + book.close(); | |
551 | + wb.close(); | |
552 | + | |
553 | + } catch (Exception e) { | |
554 | + e.printStackTrace(); | |
555 | + } | |
556 | +// pageResult.setGrid(grid); | |
557 | + return RespBuilder.buildSuccess(pageResult); | |
558 | + | |
559 | + | |
560 | + } | |
561 | + | |
562 | + | |
563 | + public BaseResponse query(Integer userId, String babyId) { | |
564 | + List<String> hospitalIds = organizationGroupsFacade.findGroupHospital(userId, false); | |
565 | + if (com.lyms.platform.operate.web.utils.CollectionUtils.isEmpty(hospitalIds)) { | |
566 | + return RespBuilder.buildSuccess(); | |
567 | + } | |
568 | + List<Map<String, Object>> rest = new ArrayList<>(); | |
569 | + BabyModelQuery babyQuery = new BabyModelQuery(); | |
570 | + babyQuery.setId(babyId); | |
571 | + babyQuery.setYn(YnEnums.YES.getId()); | |
572 | + babyQuery.setHospitalIdList(hospitalIds); | |
573 | + List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyQuery); | |
574 | + if (com.lyms.platform.operate.web.utils.CollectionUtils.isNotEmpty(models)) { | |
575 | + BabyModel babyModel = models.get(0); | |
576 | + Map<String, Object> checkRecord = new HashMap<>(); | |
577 | + checkRecord.put("id", babyModel.getId()); | |
578 | + checkRecord.put("pid", babyModel.getPid()); | |
579 | + checkRecord.put("checkTime", DateUtil.getyyyy_MM_dd(babyModel.getBuildDate())); | |
580 | + String monthAge = DateUtil.getBabyMonthAge(babyModel.getBirth(), babyModel.getBuildDate()); | |
581 | + checkRecord.put("monthAge", monthAge); | |
582 | + checkRecord.put("buildId", babyModel.getId()); | |
583 | + checkRecord.put("blNo", babyModel.getBlNo()); | |
584 | + checkRecord.put("type", "1"); | |
585 | + checkRecord.put("hospitalId", babyModel.getHospitalId()); | |
586 | + //查询建档医院 | |
587 | + Organization org = organizationService.getOrganization(Integer.valueOf(babyModel.getHospitalId())); | |
588 | + if (org != null) { | |
589 | + checkRecord.put("hospitalName", org.getName()); | |
590 | + } else { | |
591 | + checkRecord.put("hospitalName", ""); | |
592 | + } | |
593 | +// rest.add(checkRecord); | |
594 | + } | |
595 | + | |
596 | + List<BabyEyeCheck> babyEyeChecks = mongoTemplate.find(Query.query(Criteria.where("babyId").is(babyId).and("hospitalId").in(hospitalIds).and("yn").ne("0")) | |
597 | + .with(new Sort(Sort.Direction.ASC, "checkTime")), BabyEyeCheck.class); | |
598 | + for (BabyEyeCheck babyEyeCheck : babyEyeChecks) { | |
599 | + Map<String, Object> temp = new HashMap<>(); | |
600 | + temp.put("id", babyEyeCheck.getId()); | |
601 | + temp.put("hospitalId", babyEyeCheck.getHospitalId()); | |
602 | + temp.put("pid", babyEyeCheck.getPid()); | |
603 | + temp.put("checkMonth", CheckMonthEnums.getName(babyEyeCheck.getCheckMonthId())); | |
604 | + BabyModel babyModel = mongoTemplate.findById(babyEyeCheck.getBabyId(), BabyModel.class); | |
605 | + if (babyModel != null) { | |
606 | + temp.put("name", babyModel.getName()); | |
607 | + if (babyModel.getSex() != null) { | |
608 | + temp.put("sex", SexEnum.getTextById(babyModel.getSex())); | |
609 | + } | |
610 | + } | |
611 | + temp.put("checkTime", babyEyeCheck.getCheckTime() == null ? null : DateUtil.getYyyyMmDd(babyEyeCheck.getCheckTime())); | |
612 | + temp.put("doctorSign", babyEyeCheck.getDoctorSign()); | |
613 | + temp.put("guidanceOpinions", babyEyeCheck.getGuidanceOpinions()); | |
614 | + Map<String,Object> rsMap=new HashMap<>(); | |
615 | + rsMap.put("R",ifnull(babyEyeCheck.getRefractionR1())); | |
616 | + rsMap.put("L",ifnull(babyEyeCheck.getRefractionL1())); | |
617 | + temp.put("视力筛查仪", rsMap); | |
618 | + | |
619 | + | |
620 | + Map<String,Object> rslMap=new HashMap<>(); | |
621 | + rslMap.put("R",ifnull(babyEyeCheck.getRightEyeVision())); | |
622 | + rslMap.put("L",ifnull(babyEyeCheck.getLeftEyeVision())); | |
623 | + | |
624 | + temp.put("裸眼视力", rslMap); | |
625 | + CollectionUtils.removeNullValue(temp); | |
626 | + rest.add(temp); | |
627 | + } | |
628 | + return RespBuilder.buildSuccess(rest); | |
629 | + } | |
630 | + | |
631 | + public Object ifnull(Object obj,Object value){ | |
632 | + return obj==null?value:obj; | |
633 | + } | |
634 | + | |
635 | + public Object ifnull(Object obj){ | |
636 | + return obj==null?"":obj; | |
637 | + } | |
638 | + | |
639 | + /** | |
640 | + * 儿童健康检查记录表 | |
641 | + * @param id | |
642 | + * @param checkMonthAge | |
643 | + * @return | |
644 | + */ | |
645 | + public BaseResponse chkRecordLst(String id, Integer checkMonthAge) { | |
646 | + List<Map<String, Object>> rest = new ArrayList<Map<String, Object>>(); | |
647 | + | |
648 | + Criteria criteriaCheck = Criteria.where("buildId").in(id); | |
649 | + criteriaCheck.and("checkMonth").is(checkMonthAge); | |
650 | + List<BabyCheckModel> babyCheckModelList = mongoTemplate.find(new Query(criteriaCheck).with(new Sort(Sort.Direction.DESC, "created")), BabyCheckModel.class); | |
651 | + | |
652 | + return RespBuilder.buildSuccess(babyCheckModelList); | |
653 | + } | |
654 | +} |
platform-operate-api/src/main/resources/babyhealthstat.xls
View file @
bc0b087