Commit 14dc2d976fb305229b7ef8db71a56cef44081a6a

Authored by wangbo
1 parent 0c7e644fdc

宫高 腹围 等字段添加

Showing 3 changed files with 220 additions and 120 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AntenatalExaminationController.java View file @ 14dc2d9
... ... @@ -31,6 +31,8 @@
31 31 import javax.servlet.http.HttpServletRequest;
32 32 import javax.servlet.http.HttpServletResponse;
33 33 import javax.validation.Valid;
  34 +import java.awt.*;
  35 +import java.util.List;
34 36 import java.util.Map;
35 37  
36 38 /**
37 39  
... ... @@ -79,8 +81,8 @@
79 81  
80 82 @Autowired
81 83 private CouponService couponService;
  84 +
82 85 /**
83   - *
84 86 * @return
85 87 */
86 88 @RequestMapping(method = RequestMethod.GET, value = "/hischecklist")
87 89  
88 90  
89 91  
90 92  
... ... @@ -97,29 +99,26 @@
97 99 return new BaseListResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(qhdfyHisService.queryCheckList(cardNo));
98 100 } else {
99 101 return new BaseResponse().setErrorcode(ErrorCodeConstants.NO_DATA).setErrormsg("没有数据");
100   -
  102 +
101 103 }
102 104 }
103 105  
104 106  
105   -
106 107 @RequestMapping(method = RequestMethod.GET, value = "/fm")
107 108 @ResponseBody
108   - public String getFm(String start,String end,String syxh){
109   - zcfyFmService.queryFmPatient(start,end,syxh);
  109 + public String getFm(String start, String end, String syxh) {
  110 + zcfyFmService.queryFmPatient(start, end, syxh);
110 111 return "1";
111 112 }
112 113  
113 114  
114   -
115   -
116 115 /**
117 116 * gxk
118 117 * 返回新的按照日期分类的数据
119 118 */
120 119 @RequestMapping(method = RequestMethod.GET, value = "/hischecklistbydate")
121 120 @ResponseBody
122   - public BaseResponse queryHisCheckList2(String cardNo, int ftype,HttpServletRequest request) {
  121 + public BaseResponse queryHisCheckList2(String cardNo, int ftype, HttpServletRequest request) {
123 122 if ("1".equals(HIS_VERSION)) {
124 123 return new BaseListResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(hisServiceV1.queryCheckListupdate(cardNo, ftype));
125 124 } else if ("2".equals(HIS_VERSION)) {
126 125  
127 126  
... ... @@ -130,16 +129,15 @@
130 129 return new BaseListResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(qhdfyHisService.queryCheckListupdate(cardNo, ftype));
131 130 } else if ("6".equals(HIS_VERSION)) {
132 131 return new BaseListResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(dzfyHisService.queryCheckListupdate(cardNo, ftype));
133   - } else if ("7".equals(HIS_VERSION)){
  132 + } else if ("7".equals(HIS_VERSION)) {
134 133 return new BaseListResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(nczxyyLisService.queryCheckListupdate(cardNo, ftype));
135 134 } else {
136 135 return new BaseResponse().setErrorcode(ErrorCodeConstants.NO_DATA).setErrormsg("没有数据");
137   -
  136 +
138 137 }
139 138 }
140 139  
141 140  
142   -
143 141 /**
144 142 * 查询产前检查
145 143 *
146 144  
... ... @@ -149,12 +147,12 @@
149 147 @RequestMapping(method = RequestMethod.GET, value = "/antexmanage")
150 148 @ResponseBody
151 149 @TokenRequired
152   - public BaseResponse queryAntenatalExamination(@Valid AntenatalExaminationQueryRequest antenatalExaminationQueryRequest,HttpServletRequest request) {
153   - if (StringUtils.isEmpty(antenatalExaminationQueryRequest.getCardNo()) && StringUtils.isEmpty(antenatalExaminationQueryRequest.getVcCardNo())&&StringUtils.isEmpty(antenatalExaminationQueryRequest.getBarCode())) {
  150 + public BaseResponse queryAntenatalExamination(@Valid AntenatalExaminationQueryRequest antenatalExaminationQueryRequest, HttpServletRequest request) {
  151 + if (StringUtils.isEmpty(antenatalExaminationQueryRequest.getCardNo()) && StringUtils.isEmpty(antenatalExaminationQueryRequest.getVcCardNo()) && StringUtils.isEmpty(antenatalExaminationQueryRequest.getBarCode())) {
154 152 return new BaseResponse().setErrorcode(ErrorCodeConstants.PARAMETER_ERROR).setErrormsg("请输入查询条件");
155 153 }
156 154 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
157   - return antenatalExaminationFacade.queryAntenatalExamination(antenatalExaminationQueryRequest,loginState.getId());
  155 + return antenatalExaminationFacade.queryAntenatalExamination(antenatalExaminationQueryRequest, loginState.getId());
158 156 }
159 157  
160 158 /**
... ... @@ -166,7 +164,7 @@
166 164 @RequestMapping(method = RequestMethod.POST, value = "/antexmanage")
167 165 @ResponseBody
168 166 @TokenRequired
169   - public BaseResponse addOneAntenatalExamination(@Valid @RequestBody AntExAddRequest antExAddRequest,HttpServletRequest request) {
  167 + public BaseResponse addOneAntenatalExamination(@Valid @RequestBody AntExAddRequest antExAddRequest, HttpServletRequest request) {
170 168 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
171 169  
172 170 BaseResponse baseResponse = antenatalExaminationFacade.addOneAntEx(antExAddRequest, loginState.getId());
173 171  
... ... @@ -183,9 +181,9 @@
183 181 @RequestMapping(method = RequestMethod.POST, value = "/antex")
184 182 @ResponseBody
185 183 @TokenRequired
186   - public BaseResponse addOneAntEx(@Valid @RequestBody AntExcAddRequest antExcAddRequest,HttpServletRequest request) {
  184 + public BaseResponse addOneAntEx(@Valid @RequestBody AntExcAddRequest antExcAddRequest, HttpServletRequest request) {
187 185 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
188   - StopWatch stopWatch=new StopWatch("start post antex");
  186 + StopWatch stopWatch = new StopWatch("start post antex");
189 187 stopWatch.start("addOneAnetExChu");
190 188 BaseResponse baseResponse = antenatalExaminationFacade.addOneAnetExChu(antExcAddRequest, loginState.getId());
191 189 stopWatch.stop();
... ... @@ -220,7 +218,7 @@
220 218 @RequestMapping(method = RequestMethod.DELETE, value = "/antex")
221 219 @ResponseBody
222 220 @TokenRequired
223   - public BaseResponse delOneAntById(@Valid AntExQueryRequest antExQueryRequest,HttpServletRequest request) {
  221 + public BaseResponse delOneAntById(@Valid AntExQueryRequest antExQueryRequest, HttpServletRequest request) {
224 222 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
225 223 return antenatalExaminationFacade.delOneAntEx(antExQueryRequest, loginState.getId());
226 224 }
... ... @@ -235,6 +233,7 @@
235 233  
236 234 /**
237 235 * 查询高危因素 包括禁用了的
  236 + *
238 237 * @return
239 238 */
240 239 @RequestMapping(method = RequestMethod.GET, value = "/antex/getRiskEnums")
... ... @@ -252,7 +251,7 @@
252 251 @RequestMapping(method = RequestMethod.GET, value = "/antex/antexlist")
253 252 @ResponseBody
254 253 @TokenRequired
255   - public BaseResponse findAntExList(@Valid AntExListQueryRequest exListQueryRequest,HttpServletRequest request) {
  254 + public BaseResponse findAntExList(@Valid AntExListQueryRequest exListQueryRequest, HttpServletRequest request) {
256 255 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
257 256 return antenatalExaminationFacade.findAntExListTwo(exListQueryRequest, loginState.getId());
258 257 }
... ... @@ -265,7 +264,7 @@
265 264 @RequestMapping(method = RequestMethod.GET, value = "/antex/antexrecordlist")
266 265 @ResponseBody
267 266 @TokenRequired
268   - public BaseResponse findAntEx(@Valid AntExManagerQueryRequest antExManagerQueryRequest,HttpServletRequest request){
  267 + public BaseResponse findAntEx(@Valid AntExManagerQueryRequest antExManagerQueryRequest, HttpServletRequest request) {
269 268 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
270 269 return antExRecordFacade.findList(antExManagerQueryRequest, loginState.getId(), false, "true");
271 270 }
272 271  
273 272  
274 273  
... ... @@ -273,20 +272,19 @@
273 272  
274 273 /**
275 274 * 导出产检管理接口
  275 + *
276 276 * @param antExManagerQueryRequest
277 277 * @param request
278 278 * @return
279 279 */
280 280 @RequestMapping(method = RequestMethod.GET, value = "/antex/exportAntexrecordlist")
281 281 @TokenRequired
282   - public void exportFindAntEx(@Valid AntExManagerQueryRequest antExManagerQueryRequest,HttpServletRequest request,HttpServletResponse httpServletResponse){
  282 + public void exportFindAntEx(@Valid AntExManagerQueryRequest antExManagerQueryRequest, HttpServletRequest request, HttpServletResponse httpServletResponse) {
283 283 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
284   - antExRecordFacade.exportFindAntEx(antExManagerQueryRequest, loginState.getId(), false, httpServletResponse);
  284 + antExRecordFacade.exportFindAntEx(antExManagerQueryRequest, loginState.getId(), false, httpServletResponse);
285 285 }
286 286  
287 287  
288   -
289   -
290 288 /**
291 289 * 产检区域管理接口
292 290 *
... ... @@ -295,7 +293,7 @@
295 293 @RequestMapping(method = RequestMethod.GET, value = "/antex/rantexrecordlist")
296 294 @ResponseBody
297 295 @TokenRequired
298   - public BaseResponse findRegionAntEx(@Valid AntExManagerQueryRequest antExManagerQueryRequest,HttpServletRequest request){
  296 + public BaseResponse findRegionAntEx(@Valid AntExManagerQueryRequest antExManagerQueryRequest, HttpServletRequest request) {
299 297 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
300 298 return antExRecordFacade.findList(antExManagerQueryRequest, loginState.getId(), true, "true");
301 299 }
302 300  
... ... @@ -308,10 +306,11 @@
308 306 */
309 307 @RequestMapping(method = RequestMethod.GET, value = "/antex/exportrantexrecordlist")
310 308 @TokenRequired
311   - public void exportfindRegionAntEx(@Valid AntExManagerQueryRequest antExManagerQueryRequest,HttpServletRequest request,HttpServletResponse httpServletResponse){
  309 + public void exportfindRegionAntEx(@Valid AntExManagerQueryRequest antExManagerQueryRequest, HttpServletRequest request, HttpServletResponse httpServletResponse) {
312 310 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
313 311 antExRecordFacade.exportfindRegionAntEx(antExManagerQueryRequest, loginState.getId(), true, httpServletResponse);
314 312 }
  313 +
315 314 /**
316 315 * 产检劵检查验证
317 316 *
... ... @@ -320,7 +319,7 @@
320 319 @RequestMapping(method = RequestMethod.GET, value = "/checkticket")
321 320 @TokenRequired
322 321 @ResponseBody
323   - public BaseResponse checkTicket(String barCode,HttpServletRequest request){
  322 + public BaseResponse checkTicket(String barCode, HttpServletRequest request) {
324 323 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
325 324 if (StringUtils.isNotBlank(barCode)) {
326 325 String code = checkTicketService.updateTicket(barCode, 2, autoMatchFacade.getHospitalId(loginState.getId()));
327 326  
... ... @@ -340,13 +339,14 @@
340 339 @RequestMapping(method = RequestMethod.GET, value = "/last")
341 340 @TokenRequired
342 341 @ResponseBody
343   - public BaseResponse getLastCheck(HttpServletRequest request,@RequestParam("parentId")String pid){
  342 + public BaseResponse getLastCheck(HttpServletRequest request, @RequestParam("parentId") String pid) {
344 343 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
345 344 return antenatalExaminationFacade.getLastCheck(loginState.getId(), pid);
346 345 }
347 346  
348 347 /**
349 348 * 最后高危因素
  349 + *
350 350 * @param patientId
351 351 * @param request
352 352 * @return
... ... @@ -354,7 +354,7 @@
354 354 @RequestMapping(method = RequestMethod.GET, value = "/getLastRisk")
355 355 @ResponseBody
356 356 @TokenRequired
357   - public BaseResponse getLastRisk(@RequestParam(required = true) String patientId,HttpServletRequest request) {
  357 + public BaseResponse getLastRisk(@RequestParam(required = true) String patientId, HttpServletRequest request) {
358 358 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
359 359 return antenatalExaminationFacade.getLastRisk(patientId, loginState.getId());
360 360 }
... ... @@ -362,6 +362,7 @@
362 362  
363 363 /**
364 364 * 宫高曲线图
  365 + *
365 366 * @param patientId
366 367 * @param request
367 368 * @return
... ... @@ -369,7 +370,7 @@
369 370 @RequestMapping(method = RequestMethod.GET, value = "/getGongGaoCurve")
370 371 @ResponseBody
371 372 @TokenRequired
372   - public BaseResponse getGongGaoLine(@RequestParam(required = true) String patientId,HttpServletRequest request) {
  373 + public BaseResponse getGongGaoLine(@RequestParam(required = true) String patientId, HttpServletRequest request) {
373 374 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
374 375 return antenatalExaminationFacade.getGongGaoLine(patientId, loginState.getId());
375 376 }
... ... @@ -384,7 +385,7 @@
384 385 @RequestMapping(method = RequestMethod.POST, value = "/getAntenatalExRisk")
385 386 @ResponseBody
386 387 @TokenRequired
387   - public BaseResponse getAntenatalExRisk(@Valid @RequestBody AntExAddRequest antExAddRequest,HttpServletRequest request) {
  388 + public BaseResponse getAntenatalExRisk(@Valid @RequestBody AntExAddRequest antExAddRequest, HttpServletRequest request) {
388 389 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
389 390 BaseResponse baseResponse = antenatalExaminationFacade.getAntenatalExRisk(antExAddRequest, loginState.getId());
390 391 return baseResponse;
... ... @@ -399,7 +400,7 @@
399 400 @RequestMapping(method = RequestMethod.POST, value = "/getAntexExRisk")
400 401 @ResponseBody
401 402 @TokenRequired
402   - public BaseResponse getAntexExRisk(@Valid @RequestBody AntExcAddRequest antExcAddRequest,HttpServletRequest request) {
  403 + public BaseResponse getAntexExRisk(@Valid @RequestBody AntExcAddRequest antExcAddRequest, HttpServletRequest request) {
403 404 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
404 405 BaseResponse baseResponse = antenatalExaminationFacade.getAntexExRisk(antExcAddRequest, loginState.getId());
405 406 return baseResponse;
... ... @@ -408,6 +409,7 @@
408 409  
409 410 /**
410 411 * 查询某段返回内的高危孕妇
  412 + *
411 413 * @param antExManagerQueryRequest
412 414 * @param request
413 415 * @return
414 416  
415 417  
416 418  
... ... @@ -415,13 +417,49 @@
415 417 @RequestMapping(method = RequestMethod.GET, value = "/antex/getRangeRiskAntexlist")
416 418 @ResponseBody
417 419 @TokenRequired
418   - public BaseResponse getRangeRiskAntexlist(@Valid AntExManagerQueryRequest antExManagerQueryRequest,HttpServletRequest request){
  420 + public BaseResponse getRangeRiskAntexlist(@Valid AntExManagerQueryRequest antExManagerQueryRequest, HttpServletRequest request) {
419 421 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
420 422 return antExRecordFacade.getRangeRiskAntexlist(antExManagerQueryRequest, loginState.getId());
421 423 }
422 424  
  425 + /**
  426 + * 小程序添加产检记录
  427 + */
  428 + @RequestMapping(value = "/wx/input", method = RequestMethod.POST)
  429 + @ResponseBody
  430 + public BaseResponse inputWxData(
  431 + @RequestParam(value = "fuh", required = false) String fuh,
  432 + @RequestParam(value = "abdominalGirth") String abdominalGirth,
  433 + @RequestParam(value = "fhr") String fhr,
  434 + @RequestParam(value = "pid") String pid,
  435 + @RequestParam(value = "hospitalId") String hospitalId,
  436 + @RequestParam(value = "nextTime") String nextTime) {
  437 + return antExRecordFacade.inputWxData(fuh, abdominalGirth, fhr, pid, hospitalId, nextTime);
  438 + }
423 439  
  440 + /**
  441 + * 小程序返回产检历史数据
  442 + */
  443 + @RequestMapping(value = "/wx/queryAnteHistory", method = RequestMethod.GET)
  444 + @ResponseBody
  445 + public BaseResponse queryAnteHistory(
  446 + @RequestParam(value = "pid", required = false) String pid,
  447 + @RequestParam(value = "hospitalId") String hospitalId) {
424 448  
  449 + return antExRecordFacade.queryAnteHistory(hospitalId, pid);
  450 + }
  451 +
  452 +
  453 + @RequestMapping(value = "/queryAnte", method = RequestMethod.GET)
  454 + @ResponseBody
  455 + @TokenRequired
  456 + public BaseResponse queryOne(HttpServletRequest request,
  457 + @RequestParam(value = "pid", required = false) String pid
  458 +
  459 + ) {
  460 + LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
  461 + return antExRecordFacade.querOne(loginState.getId(), pid);
  462 + }
425 463  
426 464 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java View file @ 14dc2d9
1 1 package com.lyms.platform.operate.web.facade;
2 2  
  3 +import com.lyms.platform.biz.dal.IFolicAcidDao;
3 4 import com.lyms.platform.biz.service.*;
4 5 import com.lyms.platform.common.constants.ErrorCodeConstants;
5 6 import com.lyms.platform.common.enums.RiskDefaultTypeEnum;
6 7 import com.lyms.platform.common.enums.YnEnums;
7 8 import com.lyms.platform.common.result.BaseListResponse;
  9 +import com.lyms.platform.common.result.BaseObjectResponse;
8 10 import com.lyms.platform.common.result.BaseResponse;
9 11 import com.lyms.platform.common.utils.*;
10 12 import com.lyms.platform.operate.web.request.AntExManagerQueryRequest;
11 13  
... ... @@ -20,11 +22,16 @@
20 22 import com.lyms.platform.permission.service.UsersService;
21 23 import com.lyms.platform.pojo.*;
22 24 import com.lyms.platform.query.*;
  25 +import jdk.nashorn.internal.ir.LiteralNode;
23 26 import org.apache.commons.collections.CollectionUtils;
24 27 import org.apache.commons.lang.math.NumberUtils;
25 28 import org.springframework.beans.factory.annotation.Autowired;
26 29 import org.springframework.beans.factory.annotation.Qualifier;
27 30 import org.springframework.data.domain.Sort;
  31 +import org.springframework.data.mongodb.core.MongoTemplate;
  32 +import org.springframework.data.mongodb.core.query.Criteria;
  33 +import org.springframework.data.mongodb.core.query.Query;
  34 +import org.springframework.data.mongodb.core.query.Update;
28 35 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
29 36 import org.springframework.stereotype.Component;
30 37  
... ... @@ -65,6 +72,9 @@
65 72 @Qualifier("commonThreadPool")
66 73 private ThreadPoolTaskExecutor commonThreadPool;
67 74  
  75 + @Autowired
  76 + private MongoTemplate mongoTemplate;
  77 +
68 78 public void syncAntRecordToList(String hospitalId) {
69 79 recordService.syncAntRecordToList(hospitalId);
70 80 }
71 81  
72 82  
73 83  
74 84  
... ... @@ -99,23 +109,17 @@
99 109 antExRecordQuery.setCityId(antExManagerQueryRequest.getCityId());
100 110 antExRecordQuery.setAreaId(antExManagerQueryRequest.getAreaId());
101 111 antExRecordQuery.setStreetId(antExManagerQueryRequest.getStreetId());
102   - if (antExManagerQueryRequest.getFirst() != null && antExManagerQueryRequest.getFirst() == 2)
103   - {
  112 + if (antExManagerQueryRequest.getFirst() != null && antExManagerQueryRequest.getFirst() == 2) {
104 113 antExRecordQuery.setFirst(antExManagerQueryRequest.getFirst());
105 114 }
106 115  
107   - if (antExManagerQueryRequest.getIsOpinion() != null)
108   - {
  116 + if (antExManagerQueryRequest.getIsOpinion() != null) {
109 117 //是否有处理意见 0否 1是
110   - if (antExManagerQueryRequest.getIsOpinion() == 0)
111   - {
  118 + if (antExManagerQueryRequest.getIsOpinion() == 0) {
112 119 antExRecordQuery.setIsOpinion(false);
113   - }
114   - else if (antExManagerQueryRequest.getIsOpinion() == 1)
115   - {
  120 + } else if (antExManagerQueryRequest.getIsOpinion() == 1) {
116 121 antExRecordQuery.setIsOpinion(true);
117   - if (StringUtils.isNotEmpty(antExManagerQueryRequest.getTreatOpinion()))
118   - {
  122 + if (StringUtils.isNotEmpty(antExManagerQueryRequest.getTreatOpinion())) {
119 123 antExRecordQuery.setTreatOpinion(antExManagerQueryRequest.getTreatOpinion());
120 124 }
121 125 }
122 126  
... ... @@ -254,14 +258,13 @@
254 258 }
255 259  
256 260 String hospital = autoMatchFacade.getHospitalId(userId);
257   - List<AntExRecordModel> antExRecordModelList = recordService.queryAntExRecords(antExRecordQuery,Sort.Direction.DESC,"created");
258   - List<AntExManagerResult> data = getAntExRecords(antExRecordModelList, hospital, isRegion, antExManagerQueryRequest.getShowDetail());
  261 + List<AntExRecordModel> antExRecordModelList = recordService.queryAntExRecords(antExRecordQuery, Sort.Direction.DESC, "created");
  262 + List<AntExManagerResult> data = getAntExRecords(antExRecordModelList, hospital, isRegion, antExManagerQueryRequest.getShowDetail());
259 263 return new BaseListResponse().setData(data).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setPageInfo(antExRecordQuery.getPageInfo());
260 264 }
261 265  
262 266  
263   - private List<AntExManagerResult> getAntExRecords( List<AntExRecordModel> antExRecordModelList,String hospital,boolean isRegion,Integer isShowDetail)
264   - {
  267 + private List<AntExManagerResult> getAntExRecords(List<AntExRecordModel> antExRecordModelList, String hospital, boolean isRegion, Integer isShowDetail) {
265 268 List<AntExManagerResult> data = new ArrayList<>();
266 269 if (CollectionUtils.isNotEmpty(antExRecordModelList)) {
267 270 int batchSize = 4;
... ... @@ -273,7 +276,7 @@
273 276 end = antExRecordModelList.size();
274 277 }
275 278 listFuture.add(commonThreadPool.submit(new AntExRecordWorker(antExRecordModelList.subList(i, end), isRegion,
276   - organizationService, usersService, recordService, commonService, hospital, basicConfigService, antExService,patientsService)));
  279 + organizationService, usersService, recordService, commonService, hospital, basicConfigService, antExService, patientsService)));
277 280 }
278 281 for (Future f : listFuture) {
279 282 try {
... ... @@ -285,8 +288,8 @@
285 288 }
286 289 Organization og = organizationService.getOrganization(Integer.valueOf(hospital));
287 290  
288   - if(og!=null&&"2".equals(og.getCityId())&&isShowDetail==1){//需要隐藏姓名、地址
289   - for (AntExManagerResult result:data){
  291 + if (og != null && "2".equals(og.getCityId()) && isShowDetail == 1) {//需要隐藏姓名、地址
  292 + for (AntExManagerResult result : data) {
290 293 result.setName(StringUtils.encryName(result.getName()));
291 294 result.setAddr(StringUtils.encryAddr(result.getAddr()));
292 295 }
293 296  
294 297  
... ... @@ -440,11 +443,11 @@
440 443 Integer score = 0;
441 444 List<Map<String, Object>> results = commonService.resolveOtherRisk(risk);
442 445 if (CollectionUtils.isNotEmpty(results)) {
443   - for(Map result : results){
  446 + for (Map result : results) {
444 447 //高危因素名字
445   - name.append(result.get("name").toString()+",");
  448 + name.append(result.get("name").toString() + ",");
446 449 String level = result.get("levelId").toString();
447   - score += NumberUtils.toInt(result.get("score").toString(),0);
  450 + score += NumberUtils.toInt(result.get("score").toString(), 0);
448 451 if (org.apache.commons.lang.StringUtils.isNotEmpty(level) && !"null".equals(level)) {
449 452 e.gethLevel().add(level);
450 453 }
451 454  
... ... @@ -454,11 +457,11 @@
454 457 antExManagerResult.setrLevel(commonService.findRiskLevel(e.gethLevel()));
455 458 String ri = commonService.resloveFactor(e.gethRisk());
456 459 if (ri.isEmpty()) {
457   - if(StringUtils.isNotEmpty(name.toString())){
458   - ri = name.substring(0,name.length()-1);
  460 + if (StringUtils.isNotEmpty(name.toString())) {
  461 + ri = name.substring(0, name.length() - 1);
459 462 }
460 463 } else if (StringUtils.isNotEmpty(name.toString())) {
461   - ri += "," + name.substring(0,name.length()-1);
  464 + ri += "," + name.substring(0, name.length() - 1);
462 465 }
463 466 antExManagerResult.setrRisk(ri);
464 467 antExManagerResult.setScore((e.gethScore() + score));
465 468  
466 469  
467 470  
468 471  
469 472  
470 473  
471 474  
472 475  
... ... @@ -618,46 +621,40 @@
618 621 parentIds.add(pa.getId());
619 622 }
620 623 antExRecordQuery.setParentIds(parentIds);
621   - }
622   - else
623   - {
  624 + } else {
624 625 return new BaseListResponse().setData(new ArrayList()).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
625 626 }
626 627 }
627 628  
628 629 //antExRecordQuery.setLevelId(antExManagerQueryRequest.getLevel());
629   - List<AntExRecordModel> antExRecordModelList = recordService.queryAntExRecords(antExRecordQuery, Sort.Direction.DESC,"created");
630   - System.out.println("antExRecordModelList===================="+antExRecordModelList.size());
631   - Map<String,List<AntExRecordModel>> map = handleAntexRecord(antExRecordModelList);
  630 + List<AntExRecordModel> antExRecordModelList = recordService.queryAntExRecords(antExRecordQuery, Sort.Direction.DESC, "created");
  631 + System.out.println("antExRecordModelList====================" + antExRecordModelList.size());
  632 + Map<String, List<AntExRecordModel>> map = handleAntexRecord(antExRecordModelList);
632 633 AntExRecordQuery pageAntExRecordsQuery = new AntExRecordQuery();
633 634  
634 635 //查询产检新增的高危分页记录
635   - List<AntExRecordModel> pageAntExRecords = getIncrRiskAntexRecard(map,pageAntExRecordsQuery, antExManagerQueryRequest);
  636 + List<AntExRecordModel> pageAntExRecords = getIncrRiskAntexRecard(map, pageAntExRecordsQuery, antExManagerQueryRequest);
636 637  
637 638 //查询产检详情
638   - List<AntExManagerResult> data = getAntExRecords(pageAntExRecords, hospitalId, false, antExManagerQueryRequest.getShowDetail());
  639 + List<AntExManagerResult> data = getAntExRecords(pageAntExRecords, hospitalId, false, antExManagerQueryRequest.getShowDetail());
639 640  
640 641 return new BaseListResponse().setData(data).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setPageInfo(pageAntExRecordsQuery.getPageInfo());
641 642 }
642 643  
643 644  
644   - private List<AntExRecordModel> getIncrRiskAntexRecard(final Map<String,List<AntExRecordModel>> map,AntExRecordQuery pageAntExRecordsQuery,final AntExManagerQueryRequest request)
645   - {
  645 + private List<AntExRecordModel> getIncrRiskAntexRecard(final Map<String, List<AntExRecordModel>> map, AntExRecordQuery pageAntExRecordsQuery, final AntExManagerQueryRequest request) {
646 646  
647 647 initBasicData();
648 648 List<String> ids = new ArrayList<>();
649   - Map<String,List<String>> incriskMap = new HashMap<>();
  649 + Map<String, List<String>> incriskMap = new HashMap<>();
650 650  
651   - if (map.size() > 0)
652   - {
  651 + if (map.size() > 0) {
653 652 List<String> parentIds = new ArrayList<>();
654   - for (String patientId : map.keySet())
655   - {
  653 + for (String patientId : map.keySet()) {
656 654 parentIds.add(patientId);
657 655 }
658 656  
659   - if (CollectionUtils.isNotEmpty(parentIds))
660   - {
  657 + if (CollectionUtils.isNotEmpty(parentIds)) {
661 658  
662 659 List<Future> listFuture = new ArrayList<>();
663 660 int batchSize = 40;
... ... @@ -759,8 +756,8 @@
759 756 }
760 757 }
761 758 }
762   - result.put("ids",ids);
763   - result.put("inc",incriskMap);
  759 + result.put("ids", ids);
  760 + result.put("inc", incriskMap);
764 761 }
765 762 return result;
766 763 }
767 764  
... ... @@ -768,14 +765,12 @@
768 765  
769 766 for (Future f : listFuture) {
770 767 try {
771   - Map<String,Object> fmap = (Map) f.get(30, TimeUnit.SECONDS);
772   - if (fmap.get("ids") != null)
773   - {
774   - ids.addAll((List)fmap.get("ids"));
  768 + Map<String, Object> fmap = (Map) f.get(30, TimeUnit.SECONDS);
  769 + if (fmap.get("ids") != null) {
  770 + ids.addAll((List) fmap.get("ids"));
775 771 }
776   - if (fmap.get("inc") != null)
777   - {
778   - incriskMap.putAll((Map)fmap.get("inc"));
  772 + if (fmap.get("inc") != null) {
  773 + incriskMap.putAll((Map) fmap.get("inc"));
779 774 }
780 775 } catch (Exception e) {
781 776 ExceptionUtils.catchException(e, "antexrecord findList get result future error.");
... ... @@ -786,8 +781,7 @@
786 781 riskBasicMap.clear();
787 782 }
788 783  
789   - if (CollectionUtils.isEmpty(ids))
790   - {
  784 + if (CollectionUtils.isEmpty(ids)) {
791 785 return null;
792 786 }
793 787 pageAntExRecordsQuery.setNeed("true");
... ... @@ -798,10 +792,8 @@
798 792  
799 793  
800 794 List<AntExRecordModel> pageAntExRecords = recordService.queryAntExRecords(pageAntExRecordsQuery);
801   - if (CollectionUtils.isNotEmpty(pageAntExRecords))
802   - {
803   - for (AntExRecordModel model : pageAntExRecords)
804   - {
  795 + if (CollectionUtils.isNotEmpty(pageAntExRecords)) {
  796 + for (AntExRecordModel model : pageAntExRecords) {
805 797 model.setIncrhRisk(incriskMap.get(model.getId()));
806 798 }
807 799 }
808 800  
... ... @@ -810,13 +802,10 @@
810 802 }
811 803  
812 804  
813   - private boolean isExistsLevel(String level,List<String> incrHrisks)
814   - {
815   - if (StringUtils.isNotEmpty(level))
816   - {
  805 + private boolean isExistsLevel(String level, List<String> incrHrisks) {
  806 + if (StringUtils.isNotEmpty(level)) {
817 807 List<String> list = riskBasicMap.get(level);
818   - if (CollectionUtils.isNotEmpty(list))
819   - {
  808 + if (CollectionUtils.isNotEmpty(list)) {
820 809 return list.containsAll(incrHrisks);
821 810 }
822 811 return false;
823 812  
... ... @@ -824,10 +813,9 @@
824 813 return true;
825 814 }
826 815  
827   - private Map<String,List<String>> riskBasicMap = new HashMap<>();
  816 + private Map<String, List<String>> riskBasicMap = new HashMap<>();
828 817  
829   - private void initBasicData()
830   - {
  818 + private void initBasicData() {
831 819 BasicConfigQuery basicConfigQuery = new BasicConfigQuery();
832 820 basicConfigQuery.setYn(YnEnums.YES.getId());
833 821 basicConfigQuery.setParentId(SystemConfig.HIGH_RISK_ID);
834 822  
835 823  
836 824  
837 825  
838 826  
839 827  
840 828  
841 829  
... ... @@ -843,49 +831,121 @@
843 831 ids.add(bc.getId());
844 832 }
845 833 }
846   - riskBasicMap.put(basicConfig.getId(),ids);
  834 + riskBasicMap.put(basicConfig.getId(), ids);
847 835 }
848 836 }
849 837 }
850 838  
851 839  
852   - private boolean getConditionRisk(String riskId,List<String> incrHrisk,String level)
853   - {
854   - if (StringUtils.isEmpty(riskId))
855   - {
856   - return isExistsLevel(level,incrHrisk);
  840 + private boolean getConditionRisk(String riskId, List<String> incrHrisk, String level) {
  841 + if (StringUtils.isEmpty(riskId)) {
  842 + return isExistsLevel(level, incrHrisk);
857 843 }
858   - return incrHrisk.contains(riskId) && isExistsLevel(level,incrHrisk);
  844 + return incrHrisk.contains(riskId) && isExistsLevel(level, incrHrisk);
859 845 }
860 846  
861 847  
862 848 /**
863 849 * 把同一个人的产检记录放入集合
  850 + *
864 851 * @param antExRecordModelList
865 852 * @return
866 853 */
867   - private Map<String,List<AntExRecordModel>> handleAntexRecord(List<AntExRecordModel> antExRecordModelList)
868   - {
869   - Map<String,List<AntExRecordModel>> map = new HashMap<>();
870   - if (CollectionUtils.isNotEmpty(antExRecordModelList))
871   - {
872   - for (AntExRecordModel recordModel : antExRecordModelList)
873   - {
  854 + private Map<String, List<AntExRecordModel>> handleAntexRecord(List<AntExRecordModel> antExRecordModelList) {
  855 + Map<String, List<AntExRecordModel>> map = new HashMap<>();
  856 + if (CollectionUtils.isNotEmpty(antExRecordModelList)) {
  857 + for (AntExRecordModel recordModel : antExRecordModelList) {
874 858 List<AntExRecordModel> list = map.get(recordModel.getParentId());
875   - if (CollectionUtils.isEmpty(list))
876   - {
  859 + if (CollectionUtils.isEmpty(list)) {
877 860 list = new ArrayList<>();
878 861 }
879   - if (list.size() < 2)
880   - {
  862 + if (list.size() < 2) {
881 863 list.add(recordModel);
882   - map.put(recordModel.getParentId(),list);
  864 + map.put(recordModel.getParentId(), list);
883 865 }
884 866 }
885 867 }
886 868 return map;
887 869 }
888 870  
  871 + /**
  872 + * 小程序产检录入
  873 + */
  874 + public BaseResponse inputWxData(String fuh, String abdominalGirth, String fhr, String pid, String hospitalId, String nextTime) {
  875 + WxMeasureInfoModel wxMeasureInfo = new WxMeasureInfoModel();
  876 + if (StringUtils.isNotEmpty(pid) && StringUtils.isNotEmpty(hospitalId)) {
  877 + List<Map> listMap = new ArrayList<>();
  878 + Map<String, Object> yumInfosMap = new HashMap<>();
  879 + yumInfosMap.put("inputTime", DateUtil.getyyyy_MM_dd(new Date()));
  880 + yumInfosMap.put("fuh", fuh);
  881 + yumInfosMap.put("abdominalGirth", abdominalGirth);
  882 + yumInfosMap.put("fhr", fhr);
  883 + yumInfosMap.put("nextTime", nextTime);
  884 + WxMeasureInfoModel wxMeasure = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(pid).and("type").is("1")), WxMeasureInfoModel.class);
  885 + if (null == wxMeasure) {
  886 + listMap.add(yumInfosMap);
  887 + wxMeasureInfo.setYumInfos(listMap);
  888 + wxMeasureInfo.setType("1");
  889 + wxMeasureInfo.setCreateTime(new Date());
  890 + wxMeasureInfo.setPid(pid);
  891 + wxMeasureInfo.setHospitalId(hospitalId);
  892 + mongoTemplate.insert(wxMeasureInfo);
  893 + } else {
  894 + WxMeasureInfoModel wxMeasureInfoModel = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(pid).and("type").is("1")), WxMeasureInfoModel.class);
  895 + boolean exist = false;
  896 + if (CollectionUtils.isNotEmpty(wxMeasureInfoModel.getYumInfos())) {
  897 + List<Map> historyMap = wxMeasureInfoModel.getYumInfos();
  898 + for (Map map : historyMap) {
  899 + String inputTime = map.get("inputTime").toString();
  900 + String currentTime = DateUtil.getyyyy_MM_dd(new Date());
  901 + if (currentTime.equals(inputTime)) {
  902 + exist = true;
  903 + map.putAll(yumInfosMap);
  904 + break;
  905 + }
  906 + }
  907 + if (!exist) {
  908 + historyMap.add(yumInfosMap);
  909 + }
  910 + }
  911 + Update update = MongoConvertHelper.convertToNativeUpdate(ReflectionUtils.getUpdateField(wxMeasureInfoModel));
  912 + mongoTemplate.updateFirst(Query.query(Criteria.where("pid").is(pid)), update, WxMeasureInfoModel.class);
  913 + }
  914 + } else {
  915 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.DEPT_NOT_EXISTS).setErrormsg("未获取到医院名称!");
  916 + }
  917 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  918 + }
  919 +
  920 + public BaseResponse queryAnteHistory(String hospitalId, String pid) {
  921 + if (StringUtils.isNotEmpty(hospitalId) && StringUtils.isNotEmpty(pid)) {
  922 + WxMeasureInfoModel wxMeasureInfo = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(pid).and("hospitalId").is(hospitalId)), WxMeasureInfoModel.class);
  923 + if (null != wxMeasureInfo) {
  924 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setData(wxMeasureInfo.getYumInfos()).setErrormsg("成功");
  925 + }
  926 + }
  927 + return null;
  928 + }
  929 +
  930 +
  931 + public BaseResponse querOne(Integer userId, String pid) {
  932 + String hospital = autoMatchFacade.getHospitalId(userId);
  933 +
  934 + if (StringUtils.isNotEmpty(pid)) {
  935 + WxMeasureInfoModel wxMeasureInfo = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(pid).and("hospitalId").is(hospital).and("type").is("1")), WxMeasureInfoModel.class);
  936 + if (null != wxMeasureInfo) {
  937 + List<Map> listMap = wxMeasureInfo.getYumInfos();
  938 + for (Map map : listMap) {
  939 + String inputTime = map.get("inputTime").toString();
  940 + String currentTime = DateUtil.getyyyy_MM_dd(new Date());
  941 + if (currentTime.equals(inputTime)) {
  942 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setData(map).setErrormsg("成功");
  943 + }
  944 + }
  945 + }
  946 + }
  947 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setData("").setErrormsg("成功");
  948 + }
889 949  
890 950  
891 951 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyNutritionFacade.java View file @ 14dc2d9
... ... @@ -1287,6 +1287,8 @@
1287 1287 String kaupEvaluate = getBabyStatus(month, baby.getSex(), model.getHeight(), model.getWeight(), bmi);
1288 1288 map.put("bmi", bmi);
1289 1289 map.put("kaupEvaluate", kaupEvaluate);
  1290 + //获取热量值 体重在正常范围内的不计算热量值
  1291 + double kaul = getKcal(month, model.getWeight(), model.getHeight(), baby.getSex(), kaupEvaluate);
1290 1292 if (month >= 0 && month <= 5) {
1291 1293 List<BabyDietReportModel> babyDietReport = mongoTemplate.find(Query.query(Criteria.where("monthAge").is(month).and("feedingPattern").is(Integer.valueOf(model.getFeedType()))), BabyDietReportModel.class);
1292 1294 for (BabyDietReportModel babyDiet : babyDietReport) {
... ... @@ -1349,8 +1351,7 @@
1349 1351 }
1350 1352 }
1351 1353 }
1352   - //获取热量值 体重在正常范围内的不计算热量值
1353   - double kaul = getKcal(month, model.getWeight(), model.getHeight(), baby.getSex(), kaupEvaluate);
  1354 +
1354 1355 map.put("kaul", kaul + "kacl");
1355 1356 data.put("userInfo", map);
1356 1357 if ((kaupEvaluate.equals("消瘦") || kaupEvaluate.equals("超重")) && month >= 6 && month <= 11) {
... ... @@ -1408,7 +1409,8 @@
1408 1409 }
1409 1410 }
1410 1411 }
1411   -
  1412 + healthChargeFacade.addHealthCharge(hospitalId, 5, baby.getId(), null, null,
  1413 + userId, model.getInterpretDoctorId(), true, model.getId());
1412 1414 }
1413 1415 objectResponse.setData(data);
1414 1416 objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);