Commit 8fb7ae19d8ad3c99b06857f787d90064e19d0d7a

Authored by wangbo
1 parent 2295e45682
Exists in master and in 1 other branch dev

儿保蓝牙体重对接

Showing 1 changed file with 241 additions and 394 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MeasureInfoFacade.java View file @ 8fb7ae1
Diff suppressed. Click to show
... ... @@ -95,14 +95,14 @@
95 95 @Autowired
96 96 private AutoMatchFacade autoMatchFacade;
97 97  
98   - private static String[] blood_item = new String[]{"--","--","--","--","--","--","--","--","--"};
  98 + private static String[] blood_item = new String[]{"--", "--", "--", "--", "--", "--", "--", "--", "--"};
99 99  
100   - private static Integer MAX_TODAY_COUNT = 10000;
  100 + private static Integer MAX_TODAY_COUNT = 10000;
101 101  
102 102 public BaseListResponse queryMeasureInfoList(String queryNo,
103 103 Integer valueType, String vcCardNo,
104 104 String recordTime, String age,
105   - Integer page, Integer limit,Integer userId) {
  105 + Integer page, Integer limit, Integer userId) {
106 106  
107 107  
108 108 DataPermissionsModelQuery dataPermissionsModelQuery = new DataPermissionsModelQuery();
... ... @@ -124,8 +124,7 @@
124 124  
125 125 List<MeasureInfoResult> results = new ArrayList<>();
126 126 MeasureDataInfoQuery query = new MeasureDataInfoQuery();
127   - if (CollectionUtils.isNotEmpty(hospitalList))
128   - {
  127 + if (CollectionUtils.isNotEmpty(hospitalList)) {
129 128 //权限
130 129 query.setHospitalIds(hospitalList);
131 130 query.setQueryNo(queryNo);
... ... @@ -145,12 +144,9 @@
145 144 List<MeasureDataInfoModel> list = mysqlMeasureDataInfoService.queryMeasureList(query);
146 145  
147 146  
148   - if (CollectionUtils.isNotEmpty(list))
149   - {
150   - for (MeasureDataInfoModel model : list)
151   - {
152   - if (model == null || model.getMeasureUserInfoModel() == null)
153   - {
  147 + if (CollectionUtils.isNotEmpty(list)) {
  148 + for (MeasureDataInfoModel model : list) {
  149 + if (model == null || model.getMeasureUserInfoModel() == null) {
154 150 continue;
155 151 }
156 152  
157 153  
158 154  
... ... @@ -206,20 +202,16 @@
206 202 patientsQuery.setHospitalId(hospitalId);
207 203 patientsQuery.setYn(YnEnums.YES.getId());
208 204  
209   - if ("1".equals(certType))
210   - {
  205 + if ("1".equals(certType)) {
211 206 patientsQuery.setVcCardNo(certNo);
212   - }
213   - else
214   - {
  207 + } else {
215 208 patientsQuery.setPcerteTypeId(certType);
216 209 patientsQuery.setCardNo(certNo);
217 210 }
218 211 BaseObjectResponse objectResponse = new BaseObjectResponse();
219 212  
220 213 List<Patients> patientsList = patientsService.queryPatient(patientsQuery);
221   - if (CollectionUtils.isNotEmpty(patientsList))
222   - {
  214 + if (CollectionUtils.isNotEmpty(patientsList)) {
223 215 Patients patients = patientsList.get(0);
224 216  
225 217  
... ... @@ -234,8 +226,7 @@
234 226  
235 227  
236 228 List<MeasureUserInfoModel> models = mysqlMeasureUserInfoService.queryMeasureUserInfoList(query);
237   - if (CollectionUtils.isNotEmpty(models))
238   - {
  229 + if (CollectionUtils.isNotEmpty(models)) {
239 230 MeasureUserInfoModel userInfo = models.get(0);
240 231 userInfo.setVcCardNo(patients.getVcCardNo());
241 232 userInfo.setModified(new Date());
... ... @@ -250,9 +241,7 @@
250 241 // result.setHeight(dataModels.get(0).getValueTwo() == null ? "" : dataModels.get(0).getValueTwo());
251 242 // result.setWeight(dataModels.get(0).getValueOne() == null ? "" : dataModels.get(0).getValueOne());
252 243 // }
253   - }
254   - else
255   - {
  244 + } else {
256 245 MeasureUserInfoModel model = new MeasureUserInfoModel();
257 246  
258 247 model.setUserName(patients.getUsername());
... ... @@ -262,7 +251,7 @@
262 251 model.setPhone(patients.getPhone());
263 252 model.setSex(0);
264 253 if (patients.getBirth() != null) {
265   - model.setAge(DateUtil.getAge(patients.getBirth(), new Date())+"");
  254 + model.setAge(DateUtil.getAge(patients.getBirth(), new Date()) + "");
266 255 }
267 256 model.setVcCardNo(patients.getVcCardNo());
268 257 model.setAddress(addressRegister);
... ... @@ -278,7 +267,7 @@
278 267 List<AntExChuModel> chuModelList = antenatalExaminationService.queryAntExChu(antExChuQuery);
279 268 if (CollectionUtils.isNotEmpty(chuModelList)) {
280 269 AntExChuModel chuModel = chuModelList.get(0);
281   - String height = chuModel.getHeight() == null ? "" : chuModel.getHeight();
  270 + String height = chuModel.getHeight() == null ? "" : chuModel.getHeight();
282 271 result.setHeight(height);
283 272 }
284 273  
285 274  
... ... @@ -292,11 +281,9 @@
292 281 result.setAddress(addressRegister);
293 282 result.setSex(String.valueOf(0));
294 283 if (patients.getBirth() != null) {
295   - result.setAge(DateUtil.getAge(patients.getBirth(), new Date())+"");
  284 + result.setAge(DateUtil.getAge(patients.getBirth(), new Date()) + "");
296 285 }
297   - }
298   - else
299   - {
  286 + } else {
300 287 objectResponse.setErrorcode(ErrorCodeConstants.NO_DATA);
301 288 objectResponse.setErrormsg("没有建档,请建档后测量");
302 289 return objectResponse;
303 290  
... ... @@ -313,12 +300,9 @@
313 300 MeasureBaseInfoResult result = new MeasureBaseInfoResult();
314 301 MeasureUserInfoQuery query = new MeasureUserInfoQuery();
315 302 query.setHospitalId(hospitalId);
316   - if ("1".equals(certType))
317   - {
  303 + if ("1".equals(certType)) {
318 304 query.setVcCardNo(certNo);
319   - }
320   - else
321   - {
  305 + } else {
322 306 query.setCertType(certType);
323 307 query.setCertNo(certNo);
324 308 }
... ... @@ -326,8 +310,7 @@
326 310 query.setNeed("true");
327 311 query.setSort(" created desc ");
328 312 List<MeasureUserInfoModel> models = mysqlMeasureUserInfoService.queryMeasureUserInfoList(query);
329   - if (CollectionUtils.isNotEmpty(models))
330   - {
  313 + if (CollectionUtils.isNotEmpty(models)) {
331 314 MeasureUserInfoModel userInfoModel = models.get(0);
332 315 result.setHospitalId(userInfoModel.getHospitalId());
333 316 result.setUserName(userInfoModel.getUserName());
334 317  
335 318  
336 319  
... ... @@ -343,26 +326,20 @@
343 326 result.setAddress(userInfoModel.getAddress());
344 327 result.setPhone(userInfoModel.getPhone());
345 328 result.setVcCardNo(userInfoModel.getVcCardNo());
346   - }
347   - else
348   - {
  329 + } else {
349 330 PatientsQuery patientsQuery = new PatientsQuery();
350 331 patientsQuery.setHospitalId(hospitalId);
351 332  
352   - if ("1".equals(certType))
353   - {
  333 + if ("1".equals(certType)) {
354 334 patientsQuery.setVcCardNo(certNo);
355   - }
356   - else
357   - {
  335 + } else {
358 336 patientsQuery.setPcerteTypeId(certType);
359 337 patientsQuery.setCardNo(certNo);
360 338 }
361 339  
362 340  
363 341 List<Patients> patientsList = patientsService.queryPatient(patientsQuery);
364   - if (CollectionUtils.isNotEmpty(patientsList))
365   - {
  342 + if (CollectionUtils.isNotEmpty(patientsList)) {
366 343 Patients patients = patientsList.get(0);
367 344 result.setHospitalId(patients.getHospitalId());
368 345 result.setUserName(patients.getUsername());
369 346  
... ... @@ -376,14 +353,11 @@
376 353 result.setAddress(addressRegister);
377 354 result.setSex(String.valueOf(0));
378 355 if (patients.getBirth() != null) {
379   - result.setAge(DateUtil.getAge(patients.getBirth(), new Date())+"");
  356 + result.setAge(DateUtil.getAge(patients.getBirth(), new Date()) + "");
380 357 }
381   - }
382   - else
383   - {
384   - if ("216".equals(hospitalId) && !"1".equals(certType))
385   - {
386   - result = getPatientZyInfo(" and ZJH='"+certNo+"'",certType,hospitalId);
  358 + } else {
  359 + if ("216".equals(hospitalId) && !"1".equals(certType)) {
  360 + result = getPatientZyInfo(" and ZJH='" + certNo + "'", certType, hospitalId);
387 361 }
388 362 }
389 363 }
... ... @@ -398,6 +372,7 @@
398 372  
399 373 /**
400 374 * 添加测量数据
  375 + *
401 376 * @param measureInfoRequest
402 377 * @return
403 378 */
404 379  
... ... @@ -409,14 +384,12 @@
409 384 //今天测量次数
410 385 Integer todayCount = 0;
411 386 MeasureDataInfoModel dataInfoModel = getDataModel(measureInfoRequest);
412   - try
413   - {
  387 + try {
414 388 MeasureDataInfoQuery query = new MeasureDataInfoQuery();
415 389 query.setCertNo(measureInfoRequest.getCertNo());
416 390 query.setCertType(measureInfoRequest.getCertType());
417 391 query.setValueType(measureInfoRequest.getValueType());
418   - if (StringUtils.isNotEmpty(measureInfoRequest.getHospitalId()))
419   - {
  392 + if (StringUtils.isNotEmpty(measureInfoRequest.getHospitalId())) {
420 393 query.setHospitalId(measureInfoRequest.getHospitalId());
421 394 }
422 395  
423 396  
424 397  
... ... @@ -424,22 +397,17 @@
424 397  
425 398 if (CollectionUtils.isNotEmpty(list)) {
426 399 MeasureDataInfoModel measureDataInfoModel = list.get(0);
427   - if (measureDataInfoModel.getValueType() == 4)
428   - {
  400 + if (measureDataInfoModel.getValueType() == 4) {
429 401 if (DateUtil.getyyyy_MM_dd(measureDataInfoModel.getModified()).equals(DateUtil.getyyyy_MM_dd(new Date()))) {
430 402 todayCount = measureDataInfoModel.getTodayCount() + 1;
431 403 String[] items = measureDataInfoModel.getValueOne().split("/");
432   - dataInfoModel.setValueOne(getBloodSugar(items,measureInfoRequest.getRemarkValue(), measureInfoRequest.getValueOne()));
433   - }
434   - else
435   - {
436   - dataInfoModel.setValueOne(getBloodSugar(blood_item,measureInfoRequest.getRemarkValue(), measureInfoRequest.getValueOne()));
  404 + dataInfoModel.setValueOne(getBloodSugar(items, measureInfoRequest.getRemarkValue(), measureInfoRequest.getValueOne()));
  405 + } else {
  406 + dataInfoModel.setValueOne(getBloodSugar(blood_item, measureInfoRequest.getRemarkValue(), measureInfoRequest.getValueOne()));
437 407 todayCount = 1;
438 408 }
439 409 dataInfoModel.setTodayCount(todayCount);
440   - }
441   - else
442   - {
  410 + } else {
443 411 if (DateUtil.getyyyy_MM_dd(measureDataInfoModel.getModified()).equals(DateUtil.getyyyy_MM_dd(new Date()))) {
444 412 todayCount = measureDataInfoModel.getTodayCount() + 1;
445 413 if (todayCount > MAX_TODAY_COUNT) {
... ... @@ -449,10 +417,8 @@
449 417 return baseResponse;
450 418 }
451 419 dataInfoModel.setTodayCount(todayCount);
452   - dataInfoModel.setRecordContent((StringUtils.isEmpty(measureDataInfoModel.getRecordContent()) ? "" : measureDataInfoModel.getRecordContent()+ "," ) + measureInfoRequest.getValueOne());
453   - }
454   - else
455   - {
  420 + dataInfoModel.setRecordContent((StringUtils.isEmpty(measureDataInfoModel.getRecordContent()) ? "" : measureDataInfoModel.getRecordContent() + ",") + measureInfoRequest.getValueOne());
  421 + } else {
456 422 todayCount = 1;
457 423 dataInfoModel.setRecordContent(measureInfoRequest.getValueOne());
458 424 dataInfoModel.setTodayCount(todayCount);
459 425  
460 426  
... ... @@ -463,20 +429,16 @@
463 429 dataInfoModel.setId(measureDataInfoModel.getId());
464 430 dataInfoModel.setRecordCount(measureDataInfoModel.getRecordCount() + 1);
465 431 mysqlMeasureDataInfoService.updateMeasureDataInfo(dataInfoModel);
466   - }
467   - else
468   - {
  432 + } else {
469 433 MeasureUserInfoQuery queryUser = new MeasureUserInfoQuery();
470 434 queryUser.setCertNo(measureInfoRequest.getCertNo());
471 435 queryUser.setCertType(measureInfoRequest.getCertType());
472   - if (StringUtils.isNotEmpty(measureInfoRequest.getHospitalId()))
473   - {
  436 + if (StringUtils.isNotEmpty(measureInfoRequest.getHospitalId())) {
474 437 queryUser.setHospitalId(measureInfoRequest.getHospitalId());
475 438 }
476 439  
477 440 List<MeasureUserInfoModel> listUsers = mysqlMeasureUserInfoService.queryMeasureUserInfoList(queryUser);
478   - if (CollectionUtils.isNotEmpty(listUsers))
479   - {
  441 + if (CollectionUtils.isNotEmpty(listUsers)) {
480 442 dataInfoModel.setMeasureUserId(listUsers.get(0).getId());
481 443 todayCount = 1;
482 444 dataInfoModel.setCreated(new Date());
483 445  
... ... @@ -486,14 +448,12 @@
486 448 dataInfoModel.setRecordContent(measureInfoRequest.getValueOne());
487 449  
488 450 //血糖
489   - if (measureInfoRequest.getValueType() == 4 && measureInfoRequest.getRemarkValue() != null)
490   - {
491   - dataInfoModel.setValueOne(getBloodSugar(blood_item,measureInfoRequest.getRemarkValue(), measureInfoRequest.getValueOne()));
  451 + if (measureInfoRequest.getValueType() == 4 && measureInfoRequest.getRemarkValue() != null) {
  452 + dataInfoModel.setValueOne(getBloodSugar(blood_item, measureInfoRequest.getRemarkValue(), measureInfoRequest.getValueOne()));
492 453 }
493 454  
494 455 mysqlMeasureDataInfoService.addMeasureDataInfo(dataInfoModel);
495   - }
496   - else {
  456 + } else {
497 457 baseResponse.setErrorcode(ErrorCodeConstants.USER_NOT_EXISTS);
498 458 baseResponse.setErrormsg("您还没有录入基本信息,暂时不能测量");
499 459 return baseResponse;
... ... @@ -503,10 +463,8 @@
503 463 /**
504 464 * 秦皇岛判断是否是住院时候测量
505 465 */
506   - if ("216".equals(measureInfoRequest.getHospitalId()))
507   - {
508   - if (isZyRange(measureInfoRequest.getCertNo()))
509   - {
  466 + if ("216".equals(measureInfoRequest.getHospitalId())) {
  467 + if (isZyRange(measureInfoRequest.getCertNo())) {
510 468 //1 住院 2 非住院
511 469 isZy = 1;
512 470 }
513 471  
... ... @@ -514,13 +472,11 @@
514 472 MeasureUserInfoQuery queryUser = new MeasureUserInfoQuery();
515 473 queryUser.setCertNo(measureInfoRequest.getCertNo());
516 474 queryUser.setCertType(measureInfoRequest.getCertType());
517   - if (StringUtils.isNotEmpty(measureInfoRequest.getHospitalId()))
518   - {
  475 + if (StringUtils.isNotEmpty(measureInfoRequest.getHospitalId())) {
519 476 queryUser.setHospitalId(measureInfoRequest.getHospitalId());
520 477 }
521 478 List<MeasureUserInfoModel> listUsers = mysqlMeasureUserInfoService.queryMeasureUserInfoList(queryUser);
522   - if (CollectionUtils.isNotEmpty(listUsers))
523   - {
  479 + if (CollectionUtils.isNotEmpty(listUsers)) {
524 480 MeasureUserInfoModel modelUser = listUsers.get(0);
525 481 modelUser.setModified(new Date());
526 482 modelUser.setIsZy(isZy);
... ... @@ -529,9 +485,7 @@
529 485 modelUser.setPatientId(measureInfoRequest.getPatientId());
530 486 mysqlMeasureUserInfoService.updateMeasureUserInfo(modelUser);
531 487 }
532   - }
533   - catch (Exception e)
534   - {
  488 + } catch (Exception e) {
535 489 baseResponse.setErrorcode(ErrorCodeConstants.SYSTEM_ERROR);
536 490 baseResponse.setErrormsg("发生错误了,请稍后重试!");
537 491 return baseResponse;
538 492  
539 493  
540 494  
541 495  
... ... @@ -545,31 +499,26 @@
545 499 }
546 500  
547 501  
548   -
549 502 public BaseResponse addAllMeasureDataInfo(MeasureAllInfoRequest request) {
550 503 BaseObjectResponse baseResponse = new BaseObjectResponse();
551 504  
552   - if (StringUtils.isNotEmpty(request.getCertType()) && StringUtils.isNotEmpty(request.getCertNo()))
553   - {
  505 + if (StringUtils.isNotEmpty(request.getCertType()) && StringUtils.isNotEmpty(request.getCertNo())) {
554 506  
555 507 MeasureUserInfoQuery queryUser = new MeasureUserInfoQuery();
556 508 queryUser.setCertNo(request.getCertNo());
557 509 queryUser.setCertType(request.getCertType());
558   - if (StringUtils.isNotEmpty(request.getHospitalId()))
559   - {
  510 + if (StringUtils.isNotEmpty(request.getHospitalId())) {
560 511 queryUser.setHospitalId(request.getHospitalId());
561 512 }
562 513  
563 514 List<MeasureUserInfoModel> listUsers = mysqlMeasureUserInfoService.queryMeasureUserInfoList(queryUser);
564   - if (!CollectionUtils.isNotEmpty(listUsers))
565   - {
  515 + if (!CollectionUtils.isNotEmpty(listUsers)) {
566 516 baseResponse.setErrorcode(ErrorCodeConstants.USER_NOT_EXISTS);
567 517 baseResponse.setErrormsg("您还没有录入基本信息,暂时不能测量");
568 518 return baseResponse;
569 519 }
570 520  
571   - if (StringUtils.isNotEmpty(request.getWeight()) && StringUtils.isNotEmpty(request.getHeight()))
572   - {
  521 + if (StringUtils.isNotEmpty(request.getWeight()) && StringUtils.isNotEmpty(request.getHeight())) {
573 522 MeasureInfoRequest measureInfoRequest = new MeasureInfoRequest();
574 523 measureInfoRequest.setHospitalId(request.getHospitalId());
575 524 measureInfoRequest.setCertType(request.getCertType());
... ... @@ -579,8 +528,7 @@
579 528 measureInfoRequest.setValueTwo(request.getHeight());
580 529 addMeasureDataInfo(measureInfoRequest);
581 530 }
582   - if (StringUtils.isNotEmpty(request.getBloodPressure()) && StringUtils.isNotEmpty(request.getPulse()))
583   - {
  531 + if (StringUtils.isNotEmpty(request.getBloodPressure()) && StringUtils.isNotEmpty(request.getPulse())) {
584 532 MeasureInfoRequest measureInfoRequest = new MeasureInfoRequest();
585 533 measureInfoRequest.setHospitalId(request.getHospitalId());
586 534 measureInfoRequest.setCertType(request.getCertType());
... ... @@ -591,8 +539,7 @@
591 539 addMeasureDataInfo(measureInfoRequest);
592 540 }
593 541  
594   - if (StringUtils.isNotEmpty(request.getTemperature()))
595   - {
  542 + if (StringUtils.isNotEmpty(request.getTemperature())) {
596 543 MeasureInfoRequest measureInfoRequest = new MeasureInfoRequest();
597 544 measureInfoRequest.setHospitalId(request.getHospitalId());
598 545 measureInfoRequest.setCertType(request.getCertType());
... ... @@ -609,8 +556,7 @@
609 556 }
610 557  
611 558  
612   - private MeasureDataInfoModel getDataModel(MeasureInfoRequest measureInfoRequest)
613   - {
  559 + private MeasureDataInfoModel getDataModel(MeasureInfoRequest measureInfoRequest) {
614 560 MeasureDataInfoModel model = new MeasureDataInfoModel();
615 561 model.setValueThree(measureInfoRequest.getValueThree());
616 562 model.setValueOne(measureInfoRequest.getValueOne());
617 563  
... ... @@ -621,17 +567,14 @@
621 567 }
622 568  
623 569  
624   - private String getBloodSugar(String[] blood_item ,String remarkValue,String valueOne)
625   - {
626   - if (remarkValue != null)
627   - {
628   - blood_item[Integer.parseInt(remarkValue)-1] = valueOne;
  570 + private String getBloodSugar(String[] blood_item, String remarkValue, String valueOne) {
  571 + if (remarkValue != null) {
  572 + blood_item[Integer.parseInt(remarkValue) - 1] = valueOne;
629 573  
630 574 StringBuffer sb = new StringBuffer();
631 575  
632   - for (int i = 0 ; i < blood_item.length ; i++)
633   - {
634   - sb.append(blood_item[i]+(i == (blood_item.length-1) ? "" :"/"));
  576 + for (int i = 0; i < blood_item.length; i++) {
  577 + sb.append(blood_item[i] + (i == (blood_item.length - 1) ? "" : "/"));
635 578 }
636 579 return sb.toString();
637 580 }
... ... @@ -639,8 +582,7 @@
639 582 }
640 583  
641 584  
642   - public int updateHeight(String patientId,String hospitalId,String height)
643   - {
  585 + public int updateHeight(String patientId, String hospitalId, String height) {
644 586 Patients pat = patientsService.findOnePatientById(patientId);
645 587 MeasureDataInfoQuery query = new MeasureDataInfoQuery();
646 588 query.setHospitalId(hospitalId);
647 589  
... ... @@ -648,11 +590,10 @@
648 590 query.setCertType(pat.getPcerteTypeId());
649 591 query.setValueType(1);
650 592 List<MeasureDataInfoModel> list = mysqlMeasureDataInfoService.queryMeasureList(query);
651   - if (CollectionUtils.isNotEmpty(list))
652   - {
  593 + if (CollectionUtils.isNotEmpty(list)) {
653 594 MeasureDataInfoModel model = list.get(0);
654 595 model.setValueTwo(height);
655   - return mysqlMeasureDataInfoService.updateMeasureDataInfo(model);
  596 + return mysqlMeasureDataInfoService.updateMeasureDataInfo(model);
656 597 }
657 598 return 0;
658 599 }
659 600  
... ... @@ -660,13 +601,13 @@
660 601  
661 602 /**
662 603 * 添加测量人基本信息
  604 + *
663 605 * @param measureInfoRequest
664 606 * @return
665 607 */
666 608 public BaseResponse addMeasureUserInfo(MeasureInfoRequest measureInfoRequest) {
667 609 BaseResponse baseResponse = new BaseResponse();
668   - try
669   - {
  610 + try {
670 611  
671 612 MeasureUserInfoQuery queryUser = new MeasureUserInfoQuery();
672 613 queryUser.setCertNo(measureInfoRequest.getCertNo());
673 614  
... ... @@ -678,17 +619,13 @@
678 619 userModel.setId(modelUser.getId());
679 620 modelUser.setModified(new Date());
680 621 mysqlMeasureUserInfoService.updateMeasureUserInfo(userModel);
681   - }
682   - else
683   - {
  622 + } else {
684 623 MeasureUserInfoModel userModel = getUserModel(measureInfoRequest);
685 624 userModel.setCreated(new Date());
686 625 userModel.setModified(new Date());
687 626 mysqlMeasureUserInfoService.addMeasureUserInfo(userModel);
688 627 }
689   - }
690   - catch (Exception e)
691   - {
  628 + } catch (Exception e) {
692 629 baseResponse.setErrorcode(ErrorCodeConstants.SYSTEM_ERROR);
693 630 baseResponse.setErrormsg(ErrorCodeConstants.SYSTEM_ERROR_DESCRIPTION);
694 631 return baseResponse;
... ... @@ -699,9 +636,7 @@
699 636 }
700 637  
701 638  
702   -
703   - private MeasureUserInfoModel getUserModel(MeasureInfoRequest measureInfoRequest)
704   - {
  639 + private MeasureUserInfoModel getUserModel(MeasureInfoRequest measureInfoRequest) {
705 640 MeasureUserInfoModel model = new MeasureUserInfoModel();
706 641 model.setUserName(measureInfoRequest.getUserName());
707 642 model.setCertType(measureInfoRequest.getCertType());
708 643  
709 644  
710 645  
711 646  
... ... @@ -723,29 +658,23 @@
723 658  
724 659 /**
725 660 * 是否在住院范围内测量
  661 + *
726 662 * @return
727 663 */
728   - public boolean isZyRange(String certNo)
729   - {
  664 + public boolean isZyRange(String certNo) {
730 665 Connection conn = com.lyms.hospitalapi.qhdfy.ConnTools.makeClConnection();
731   - try
732   - {
  666 + try {
733 667 QueryRunner queryRunner = new QueryRunner();
734 668 List<MeasurePatientInfo> list = queryRunner.query(conn, " select ZJH as certNo,XM as userName,NL as age,XB as sex, SJH as phone,INP_NO as zyNo,VISIT_ID as visitId,PATIENT_ID as patientId,DZ as address,RYSJ as inDate,CYSJ as outDate from lyms " +
735   - " where ZJH='"+certNo+"' order by RYSJ desc ", new BeanListHandler<MeasurePatientInfo>(MeasurePatientInfo.class));
736   - if (CollectionUtils.isNotEmpty(list))
737   - {
  669 + " where ZJH='" + certNo + "' order by RYSJ desc ", new BeanListHandler<MeasurePatientInfo>(MeasurePatientInfo.class));
  670 + if (CollectionUtils.isNotEmpty(list)) {
738 671 MeasurePatientInfo info = list.get(0);
739 672 Date outDate = info.getOutDate();
740 673 return outDate == null;
741 674 }
742   - }
743   - catch (Exception e)
744   - {
745   - ExceptionUtils.catchException(e,"查询基本信息出错");
746   - }
747   - finally
748   - {
  675 + } catch (Exception e) {
  676 + ExceptionUtils.catchException(e, "查询基本信息出错");
  677 + } finally {
749 678 DbUtils.closeQuietly(conn);
750 679 }
751 680 return false;
752 681  
753 682  
754 683  
... ... @@ -754,66 +683,56 @@
754 683  
755 684 /**
756 685 * 查询患者的住院信息
  686 + *
757 687 * @param conditionSql
758 688 * @return
759 689 */
760   - public MeasureBaseInfoResult getPatientZyInfo(String conditionSql,String certType,String hospitalId)
761   - {
762   - MeasureBaseInfoResult result = null;
763   - Connection conn = com.lyms.hospitalapi.qhdfy.ConnTools.makeClConnection();
764   - try {
765   - QueryRunner queryRunner = new QueryRunner();
766   - List<MeasurePatientInfo> list = queryRunner.query(conn, "select ZJH as certNo,XM as userName,NL as age,XB as sex, SJH as phone,INP_NO as zyNo,VISIT_ID as visitId,PATIENT_ID as patientId,DZ as address,RYSJ as inDate,CYSJ as outDate from lyms " +
767   - " where 1 = 1 "+conditionSql+" order by RYSJ desc ", new BeanListHandler<MeasurePatientInfo>(MeasurePatientInfo.class));
768   - if (CollectionUtils.isNotEmpty(list))
769   - {
770   - result = new MeasureBaseInfoResult();
771   - MeasurePatientInfo model = list.get(0);
772   - result.setUserName(model.getUserName() == null ? "" : model.getUserName());
773   - result.setCertType(certType);
774   - result.setCertNo(model.getCertNo() == null ? "" : model.getCertNo());
775   - result.setSex("女".equals(model.getSex().trim()) ? "0" : "1");
776   - String age = "";
777   - if (StringUtils.isNotEmpty(model.getAge()))
778   - {
779   - try {
780   - age = model.getAge().substring(0,model.getAge().length() - 1);
781   - Integer.valueOf(age);
782   - }catch (Exception e)
783   - {
784   - System.out.print(model.getAge()+":年龄解析错误"+e.toString());
785   - }
786   - }
787   - result.setAge(age);
788   - result.setPhone(model.getPhone() == null ? "" : model.getPhone());
789   - result.setVcCardNo(model.getVcCardNo() == null ? "" : model.getVcCardNo());
790   - result.setVisitId(model.getVisitId() == null ? "" : model.getVisitId());
791   - result.setZyNo(model.getZyNo() == null ? "" : model.getZyNo());
792   - result.setPatientId(model.getPatientId() == null ? "" : model.getPatientId());
793   - result.setHospitalId(hospitalId);
794   - }
795   - return result;
796   - }
797   - catch (Exception e)
798   - {
799   - ExceptionUtils.catchException(e,"查询基本信息出错");
800   - }
801   - finally
802   - {
803   - DbUtils.closeQuietly(conn);
804   - }
805   - return result;
806   - }
  690 + public MeasureBaseInfoResult getPatientZyInfo(String conditionSql, String certType, String hospitalId) {
  691 + MeasureBaseInfoResult result = null;
  692 + Connection conn = com.lyms.hospitalapi.qhdfy.ConnTools.makeClConnection();
  693 + try {
  694 + QueryRunner queryRunner = new QueryRunner();
  695 + List<MeasurePatientInfo> list = queryRunner.query(conn, "select ZJH as certNo,XM as userName,NL as age,XB as sex, SJH as phone,INP_NO as zyNo,VISIT_ID as visitId,PATIENT_ID as patientId,DZ as address,RYSJ as inDate,CYSJ as outDate from lyms " +
  696 + " where 1 = 1 " + conditionSql + " order by RYSJ desc ", new BeanListHandler<MeasurePatientInfo>(MeasurePatientInfo.class));
  697 + if (CollectionUtils.isNotEmpty(list)) {
  698 + result = new MeasureBaseInfoResult();
  699 + MeasurePatientInfo model = list.get(0);
  700 + result.setUserName(model.getUserName() == null ? "" : model.getUserName());
  701 + result.setCertType(certType);
  702 + result.setCertNo(model.getCertNo() == null ? "" : model.getCertNo());
  703 + result.setSex("女".equals(model.getSex().trim()) ? "0" : "1");
  704 + String age = "";
  705 + if (StringUtils.isNotEmpty(model.getAge())) {
  706 + try {
  707 + age = model.getAge().substring(0, model.getAge().length() - 1);
  708 + Integer.valueOf(age);
  709 + } catch (Exception e) {
  710 + System.out.print(model.getAge() + ":年龄解析错误" + e.toString());
  711 + }
  712 + }
  713 + result.setAge(age);
  714 + result.setPhone(model.getPhone() == null ? "" : model.getPhone());
  715 + result.setVcCardNo(model.getVcCardNo() == null ? "" : model.getVcCardNo());
  716 + result.setVisitId(model.getVisitId() == null ? "" : model.getVisitId());
  717 + result.setZyNo(model.getZyNo() == null ? "" : model.getZyNo());
  718 + result.setPatientId(model.getPatientId() == null ? "" : model.getPatientId());
  719 + result.setHospitalId(hospitalId);
  720 + }
  721 + return result;
  722 + } catch (Exception e) {
  723 + ExceptionUtils.catchException(e, "查询基本信息出错");
  724 + } finally {
  725 + DbUtils.closeQuietly(conn);
  726 + }
  727 + return result;
  728 + }
807 729  
808 730 public BaseObjectResponse getMeasurePatientInfo(String certType, String certNo, String hospitalId) {
809 731 MeasureBaseInfoResult result = new MeasureBaseInfoResult();
810 732 MeasureUserInfoQuery query = new MeasureUserInfoQuery();
811   - if ("1".equals(certType))
812   - {
  733 + if ("1".equals(certType)) {
813 734 query.setVcCardNo(certNo);
814   - }
815   - else
816   - {
  735 + } else {
817 736 query.setCertType(certType);
818 737 query.setCertNo(certNo);
819 738 }
... ... @@ -822,8 +741,7 @@
822 741 query.setNeed("true");
823 742 query.setSort(" created desc ");
824 743 List<MeasureUserInfoModel> models = mysqlMeasureUserInfoService.queryMeasureUserInfoList(query);
825   - if (CollectionUtils.isNotEmpty(models))
826   - {
  744 + if (CollectionUtils.isNotEmpty(models)) {
827 745 MeasureUserInfoModel userInfoModel = models.get(0);
828 746 result.setUserName(userInfoModel.getUserName());
829 747 result.setCertNo(userInfoModel.getCertNo());
830 748  
... ... @@ -839,18 +757,15 @@
839 757 MeasureDataInfoQuery measureDataInfoQuery = new MeasureDataInfoQuery();
840 758 measureDataInfoQuery.setMeasureUserId(userInfoModel.getId());
841 759 measureDataInfoQuery.setValueType(1);
842   - List<MeasureDataInfoModel> dataModels = mysqlMeasureDataInfoService.queryMeasureDataInfoList(measureDataInfoQuery);
843   - if (CollectionUtils.isNotEmpty(dataModels))
844   - {
  760 + List<MeasureDataInfoModel> dataModels = mysqlMeasureDataInfoService.queryMeasureDataInfoList(measureDataInfoQuery);
  761 + if (CollectionUtils.isNotEmpty(dataModels)) {
845 762 result.setHeight(dataModels.get(0).getValueTwo() == null ? "" : dataModels.get(0).getValueTwo());
846 763 result.setWeight(dataModels.get(0).getValueOne() == null ? "" : dataModels.get(0).getValueOne());
847 764 }
848 765 }
849   - if ("216".equals(hospitalId))
850   - {
851   - MeasureBaseInfoResult zyInfo = getPatientZyInfo(" and ZJH='"+certNo+"'",certType,hospitalId);
852   - if (zyInfo != null)
853   - {
  766 + if ("216".equals(hospitalId)) {
  767 + MeasureBaseInfoResult zyInfo = getPatientZyInfo(" and ZJH='" + certNo + "'", certType, hospitalId);
  768 + if (zyInfo != null) {
854 769 result.setZyNo(zyInfo.getZyNo());
855 770 result.setVisitId(zyInfo.getVisitId());
856 771 result.setPatientId(zyInfo.getPatientId());
857 772  
858 773  
859 774  
860 775  
861 776  
... ... @@ -863,36 +778,29 @@
863 778 return objectResponse;
864 779 }
865 780  
866   - public Map<String,Object> getMeasureInfo(String certType,String certNo,String hospitalId)
867   - {
868   - Map<String,Object> measureMap = new HashMap<>();
  781 + public Map<String, Object> getMeasureInfo(String certType, String certNo, String hospitalId) {
  782 + Map<String, Object> measureMap = new HashMap<>();
869 783 MeasureDataInfoQuery query = new MeasureDataInfoQuery();
870 784 query.setCertNo(certNo);
871 785 query.setCertType(certType);
872 786 query.setHospitalId(hospitalId);
873 787 query.setModified(DateUtil.getyyyy_MM_dd(new Date()));
874 788 List<MeasureDataInfoModel> list = mysqlMeasureDataInfoService.queryMeasureList(query);
875   - if (CollectionUtils.isNotEmpty(list))
876   - {
877   - for (MeasureDataInfoModel dataInfoModel : list)
878   - {
  789 + if (CollectionUtils.isNotEmpty(list)) {
  790 + for (MeasureDataInfoModel dataInfoModel : list) {
879 791 //值类型: 1 体重和身高 2 血压和脉搏 3、体温
880   - if (dataInfoModel.getValueType() != null && dataInfoModel.getValueType() == 1)
881   - {
882   - measureMap.put("weight",dataInfoModel.getValueOne());
883   - measureMap.put("height",dataInfoModel.getValueTwo());
884   - measureMap.put("beforeWeight",dataInfoModel.getRemarkValue() == null ? "" : dataInfoModel.getRemarkValue());
885   - }
886   - else if (dataInfoModel.getValueType() != null && dataInfoModel.getValueType() == 2)
887   - {
  792 + if (dataInfoModel.getValueType() != null && dataInfoModel.getValueType() == 1) {
  793 + measureMap.put("weight", dataInfoModel.getValueOne());
  794 + measureMap.put("height", dataInfoModel.getValueTwo());
  795 + measureMap.put("beforeWeight", dataInfoModel.getRemarkValue() == null ? "" : dataInfoModel.getRemarkValue());
  796 + } else if (dataInfoModel.getValueType() != null && dataInfoModel.getValueType() == 2) {
888 797 String recordContent = dataInfoModel.getRecordContent();
889   - if (StringUtils.isNotEmpty(recordContent))
890   - {
  798 + if (StringUtils.isNotEmpty(recordContent)) {
891 799 List<String> recordContents = Arrays.asList(recordContent.split(","));
892 800 Collections.reverse(recordContents);
893   - measureMap.put("bloodPressure",recordContents);
  801 + measureMap.put("bloodPressure", recordContents);
894 802 }
895   - measureMap.put("pulse",dataInfoModel.getValueTwo());
  803 + measureMap.put("pulse", dataInfoModel.getValueTwo());
896 804 }
897 805 }
898 806 }
899 807  
... ... @@ -903,16 +811,13 @@
903 811 /**
904 812 * 处理历史测量保存的数据
905 813 */
906   - public void doHistoryMeasureData()
907   - {
  814 + public void doHistoryMeasureData() {
908 815 MeasureDataInfoQuery query = new MeasureDataInfoQuery();
909 816 query.setModifiedTimeEnd(DateUtil.parseYMD(DateUtil.getymd()));
910 817 query.setModifiedTimeStart(DateUtil.addDay(new Date(), -2));
911 818 List<MeasureDataInfoModel> list = mysqlMeasureDataInfoService.queryMeasureList(query);
912   - if (CollectionUtils.isNotEmpty(list))
913   - {
914   - for (MeasureDataInfoModel model : list)
915   - {
  819 + if (CollectionUtils.isNotEmpty(list)) {
  820 + for (MeasureDataInfoModel model : list) {
916 821 model.setRecordContent("");
917 822 mysqlMeasureDataInfoService.updateMeasureDataInfo(model);
918 823 }
... ... @@ -922,7 +827,8 @@
922 827  
923 828  
924 829 /**
925   - * 1身份证 2就诊卡
  830 + * 1身份证 2就诊卡
  831 + *
926 832 * @param certType
927 833 * @param certNo
928 834 * @param hospitalId
929 835  
930 836  
931 837  
... ... @@ -931,27 +837,23 @@
931 837 public BaseObjectResponse getNutritionPatientInfo(Integer certType, String certNo, String hospitalId) {
932 838 BaseObjectResponse objectResponse = new BaseObjectResponse();
933 839 PatientsQuery patientsQuery = new PatientsQuery();
934   - if (1 == certType)
935   - {
  840 + if (1 == certType) {
936 841 patientsQuery.setCardNo(certNo);
937   - }
938   - else if (2 == certType)
939   - {
  842 + } else if (2 == certType) {
940 843 patientsQuery.setVcCardNo(certNo);
941 844 }
942 845  
943 846 patientsQuery.setHospitalId(hospitalId);
944 847 patientsQuery.setYn(YnEnums.YES.getId());
945   - List<Patients> patientses = patientsService.queryPatient(patientsQuery);
946   - if (CollectionUtils.isEmpty(patientses))
947   - {
  848 + List<Patients> patientses = patientsService.queryPatient(patientsQuery);
  849 + if (CollectionUtils.isEmpty(patientses)) {
948 850 objectResponse.setErrorcode(ErrorCodeConstants.NO_DATA);
949 851 objectResponse.setErrormsg("测量用户还未建档");
950 852 return objectResponse;
951 853 }
952 854  
953 855 Patients pat = patientses.get(0);
954   - Map<String,String> patInfo = getPatInfo(pat,hospitalId,certType);
  856 + Map<String, String> patInfo = getPatInfo(pat, hospitalId, certType);
955 857 objectResponse.setData(patInfo);
956 858 objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
957 859 objectResponse.setErrormsg("成功");
958 860  
... ... @@ -959,14 +861,13 @@
959 861 }
960 862  
961 863  
962   - public Map<String,String> getPatInfo(Patients pat,String hospitalId,Integer certType)
963   - {
  864 + public Map<String, String> getPatInfo(Patients pat, String hospitalId, Integer certType) {
964 865  
965   - Map<String,String> patInfo = new HashMap<>();
966   - patInfo.put("userName",pat.getUsername());
967   - patInfo.put("age",DateUtil.getAge(pat.getBirth())+"岁");
968   - patInfo.put("week",DateUtil.getWeekDesc(pat.getLastMenses(), new Date()));
969   - patInfo.put("dueDate",DateUtil.getyyyy_MM_dd(DateUtil.addDay(pat.getLastMenses(), 280)));
  866 + Map<String, String> patInfo = new HashMap<>();
  867 + patInfo.put("userName", pat.getUsername());
  868 + patInfo.put("age", DateUtil.getAge(pat.getBirth()) + "岁");
  869 + patInfo.put("week", DateUtil.getWeekDesc(pat.getLastMenses(), new Date()));
  870 + patInfo.put("dueDate", DateUtil.getyyyy_MM_dd(DateUtil.addDay(pat.getLastMenses(), 280)));
970 871 patInfo.put("phone", pat.getPhone());
971 872 patInfo.put("vcCardNo", pat.getVcCardNo());
972 873 patInfo.put("certType", String.valueOf(certType));
973 874  
... ... @@ -979,18 +880,15 @@
979 880 String currentWeight = "";
980 881 String lastWeight = "";
981 882  
982   - List<PatientWeight> patientWeights = patientWeightService2.queryPatientWeight(Query.query(Criteria.where("patientId").is(pat.getId())));
983   - if (CollectionUtils.isNotEmpty(patientWeights))
984   - {
  883 + List<PatientWeight> patientWeights = patientWeightService2.queryPatientWeight(Query.query(Criteria.where("patientId").is(pat.getId())));
  884 + if (CollectionUtils.isNotEmpty(patientWeights)) {
985 885 PatientWeight weight = patientWeights.get(0);
986 886 bmi = weight.getBmi() == null ? "" : weight.getBmi();
987 887 beforeWeight = weight.getBeforeWeight() == null ? "" : weight.getBeforeWeight();
988   - beforeHeight = weight.getBeforeHeight() == null ? "" : weight.getBeforeHeight();
989   - lastWeight = weight.getNowWeight() == null ? "" : weight.getNowWeight();
990   - tireNumber = (StringUtils.isEmpty(weight.getBregmatic()) || "null".equals(weight.getBregmatic())) ? "1" : (Integer.valueOf(weight.getBregmatic()) < 3 ? weight.getBregmatic() : weight.getBregmaticOther());
991   - }
992   - else
993   - {
  888 + beforeHeight = weight.getBeforeHeight() == null ? "" : weight.getBeforeHeight();
  889 + lastWeight = weight.getNowWeight() == null ? "" : weight.getNowWeight();
  890 + tireNumber = (StringUtils.isEmpty(weight.getBregmatic()) || "null".equals(weight.getBregmatic())) ? "1" : (Integer.valueOf(weight.getBregmatic()) < 3 ? weight.getBregmatic() : weight.getBregmaticOther());
  891 + } else {
994 892 AntExChuQuery antExChuQuery = new AntExChuQuery();
995 893 antExChuQuery.setHospitalId(hospitalId);
996 894 antExChuQuery.setParentId(pat.getId());
... ... @@ -999,7 +897,7 @@
999 897 if (CollectionUtils.isNotEmpty(chuModelList)) {
1000 898 AntExChuModel chuModel = chuModelList.get(0);
1001 899 beforeWeight = chuModel.getYqWeight() == null ? "" : chuModel.getYqWeight();
1002   - beforeHeight = chuModel.getHeight() == null ? "" : chuModel.getHeight();
  900 + beforeHeight = chuModel.getHeight() == null ? "" : chuModel.getHeight();
1003 901 tireNumber = chuModel.getTireNumber() == null ? "" : chuModel.getTireNumber();
1004 902 bmi = chuModel.getBaricIndex() == null ? "" : chuModel.getBaricIndex();
1005 903 }
1006 904  
1007 905  
... ... @@ -1020,19 +918,18 @@
1020 918 public BaseObjectResponse addNutritionInfo(NutritionInfoRequest nutritionInfoRequest) {
1021 919  
1022 920 Patients patients = patientsService.findOnePatientById(nutritionInfoRequest.getPatientId());
1023   - List<PatientWeight> patientWeights = patientWeightService2.queryPatientWeight(Query.query(Criteria.where("patientId").is(nutritionInfoRequest.getPatientId())));
  921 + List<PatientWeight> patientWeights = patientWeightService2.queryPatientWeight(Query.query(Criteria.where("patientId").is(nutritionInfoRequest.getPatientId())));
1024 922 String hospitalId = nutritionInfoRequest.getHospitalId();
1025 923  
1026 924 Map<String, String> dayWeights = new LinkedHashMap<>();
1027 925 List<Map<String, Object>> dayWeights2 = new ArrayList<>();
1028 926  
1029 927 String currentWeight = nutritionInfoRequest.getCurrentWeight();
1030   - if (CollectionUtils.isNotEmpty(patientWeights))
1031   - {
  928 + if (CollectionUtils.isNotEmpty(patientWeights)) {
1032 929 PatientWeight pw = patientWeights.get(0);
1033 930  
1034   - if(pw != null) {
1035   - if(MapUtils.isNotEmpty(pw.getDayWeights())) {
  931 + if (pw != null) {
  932 + if (MapUtils.isNotEmpty(pw.getDayWeights())) {
1036 933 dayWeights = pw.getDayWeights();
1037 934 }
1038 935 dayWeights.put(DateUtil.getyyyy_MM_dd(new Date()), currentWeight);
1039 936  
... ... @@ -1041,11 +938,11 @@
1041 938  
1042 939 String ymdDate = DateUtil.getyyyy_MM_dd(new Date());
1043 940 boolean flag = true;
1044   - if(com.lyms.platform.operate.web.utils.CollectionUtils.isNotEmpty(pw.getDayWeights2())) {
  941 + if (com.lyms.platform.operate.web.utils.CollectionUtils.isNotEmpty(pw.getDayWeights2())) {
1045 942 dayWeights2 = pw.getDayWeights2();
1046 943 }
1047 944 for (Map<String, Object> map : dayWeights2) {
1048   - if(map.get("date").equals(ymdDate)) {
  945 + if (map.get("date").equals(ymdDate)) {
1049 946 flag = false;
1050 947 map.put("hospitalId", hospitalId);
1051 948 map.put("hospitalName", couponMapper.getHospitalName(hospitalId));
... ... @@ -1053,7 +950,7 @@
1053 950 map.put("nowWeight", currentWeight);
1054 951 }
1055 952 }
1056   - if(flag) {
  953 + if (flag) {
1057 954 Map<String, Object> m = new HashMap<>();
1058 955 m.put("hospitalId", hospitalId);
1059 956 m.put("hospitalName", couponMapper.getHospitalName(hospitalId));
1060 957  
1061 958  
... ... @@ -1065,23 +962,17 @@
1065 962 pw.setModified(new Date());
1066 963 patientWeightService2.update(Query.query(Criteria.where("id").is(pw.getId())), pw);
1067 964 }
1068   - }
1069   - else
1070   - {
1071   - PatientWeight patientWeight = new PatientWeight();
  965 + } else {
  966 + PatientWeight patientWeight = new PatientWeight();
1072 967 patientWeight.setNowWeight(currentWeight);
1073 968 patientWeight.setPatientId(patients.getId());
1074 969 patientWeight.setBeforeWeight(nutritionInfoRequest.getBeforeWeight());
1075 970 patientWeight.setBeforeHeight(nutritionInfoRequest.getBeforeHeight());
1076   - if (StringUtils.isNotEmpty(nutritionInfoRequest.getTireNumber()))
1077   - {
1078   - if (Integer.valueOf(nutritionInfoRequest.getTireNumber()) < 3)
1079   - {
  971 + if (StringUtils.isNotEmpty(nutritionInfoRequest.getTireNumber())) {
  972 + if (Integer.valueOf(nutritionInfoRequest.getTireNumber()) < 3) {
1080 973 patientWeight.setBregmatic(nutritionInfoRequest.getTireNumber());
1081   - }
1082   - else
1083   - {
1084   - patientWeight.setBregmatic(3+"");
  974 + } else {
  975 + patientWeight.setBregmatic(3 + "");
1085 976 patientWeight.setBregmaticOther(nutritionInfoRequest.getTireNumber());
1086 977 }
1087 978 }
... ... @@ -1092,7 +983,7 @@
1092 983 patientWeight.setHospitalId(hospitalId);
1093 984 // patientWeight.setOperaterId(userId.toString());
1094 985 patientWeight.setCreated(new Date());
1095   - if(StringUtils.isNotBlank(nutritionInfoRequest.getBeforeWeight()) && nutritionInfoRequest.getBeforeHeight() != null) {
  986 + if (StringUtils.isNotBlank(nutritionInfoRequest.getBeforeWeight()) && nutritionInfoRequest.getBeforeHeight() != null) {
1096 987 patientWeight.setBmi(patientWeightService.getBmi(nutritionInfoRequest.getBeforeWeight(), nutritionInfoRequest.getBeforeHeight()));
1097 988 }
1098 989 patientWeight.setYn("1");
... ... @@ -1141,7 +1032,7 @@
1141 1032  
1142 1033 public BaseObjectResponse getFaceInfo(String patientId) {
1143 1034 Patients patients = patientsService.findOnePatientById(patientId);
1144   - Map<String,String> faceData = new HashMap<>();
  1035 + Map<String, String> faceData = new HashMap<>();
1145 1036 faceData.put("face", patients.getFace() == null ? "" : patients.getFace());
1146 1037 BaseObjectResponse objectResponse = new BaseObjectResponse();
1147 1038 objectResponse.setData(faceData);
... ... @@ -1162,7 +1053,6 @@
1162 1053 }
1163 1054  
1164 1055  
1165   -
1166 1056 public BaseResponse addBloodPressure(NutritionInfoRequest nutritionInfoRequest) {
1167 1057  
1168 1058 BloodPressure bloodPressure = new BloodPressure();
1169 1059  
... ... @@ -1181,10 +1071,10 @@
1181 1071 temp.put("hospitalId", hospitalId);
1182 1072 Patients p = mongoTemplate.findById(bloodPressure.getParentId(), Patients.class);
1183 1073 BloodPressure bp = null;
1184   - if(p != null) {
  1074 + if (p != null) {
1185 1075 bp = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(p.getPid())), BloodPressure.class);
1186 1076 }
1187   - if(bp == null) {
  1077 + if (bp == null) {
1188 1078 String parentId = mongoUtil.doHidePatient(bloodPressure.getParentId(), hospitalId);
1189 1079 bloodPressure.setPid(mongoUtil.getPid(parentId));
1190 1080 bloodPressure.setParentId(parentId);
... ... @@ -1213,7 +1103,7 @@
1213 1103 measureInfoRequest.setPhone(p.getPhone());
1214 1104 measureInfoRequest.setSex(0);
1215 1105 measureInfoRequest.setUserName(p.getUsername());
1216   - measureInfoRequest.setAge(DateUtil.getAge(p.getBirth())+"");
  1106 + measureInfoRequest.setAge(DateUtil.getAge(p.getBirth()) + "");
1217 1107 addMeasureUserInfo(measureInfoRequest);
1218 1108  
1219 1109 MeasureInfoRequest request = new MeasureInfoRequest();
... ... @@ -1222,8 +1112,8 @@
1222 1112 request.setCertType(p.getPcerteTypeId());
1223 1113 request.setHospitalId(hospitalId);
1224 1114 request.setValueType(2);//血压和脉搏
1225   - request.setValueOne(nutritionInfoRequest.getSsy()+"/"+nutritionInfoRequest.getSzy());
1226   - request.setValueTwo(nutritionInfoRequest.getPulse()+"");
  1115 + request.setValueOne(nutritionInfoRequest.getSsy() + "/" + nutritionInfoRequest.getSzy());
  1116 + request.setValueTwo(nutritionInfoRequest.getPulse() + "");
1227 1117  
1228 1118 addToDataInfo(request);
1229 1119  
... ... @@ -1231,7 +1121,6 @@
1231 1121 }
1232 1122  
1233 1123  
1234   -
1235 1124 public BaseObjectResponse getFacePairMatching(NutritionInfoRequest request) {
1236 1125 BaseObjectResponse objectResponse = new BaseObjectResponse();
1237 1126  
... ... @@ -1241,15 +1130,11 @@
1241 1130 patientsQuery.setBookbuildingDateStart(DateUtil.addYear(new Date(), -1));
1242 1131 patientsQuery.setBookbuildingDateEnd(DateUtil.addDay(new Date(), 1));
1243 1132 List<Patients> patientses = patientsService.queryPatient(patientsQuery);
1244   - if (CollectionUtils.isNotEmpty(patientses))
1245   - {
1246   - for (Patients pat : patientses)
1247   - {
1248   - if (StringUtils.isNotEmpty(pat.getFace()) && StringUtils.isNotEmpty(request.getFace()))
1249   - {
1250   - if (AfrFaceUtil.facePairMatching(pat.getFace(),request.getFace()) >= 0.5f)
1251   - {
1252   - Map<String,String> patInfo = getPatInfo(pat,request.getHospitalId(),1);
  1133 + if (CollectionUtils.isNotEmpty(patientses)) {
  1134 + for (Patients pat : patientses) {
  1135 + if (StringUtils.isNotEmpty(pat.getFace()) && StringUtils.isNotEmpty(request.getFace())) {
  1136 + if (AfrFaceUtil.facePairMatching(pat.getFace(), request.getFace()) >= 0.5f) {
  1137 + Map<String, String> patInfo = getPatInfo(pat, request.getHospitalId(), 1);
1253 1138 objectResponse.setData(patInfo);
1254 1139 objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
1255 1140 objectResponse.setErrormsg("成功");
... ... @@ -1267,6 +1152,7 @@
1267 1152  
1268 1153 /**
1269 1154 * 添加测量数据到
  1155 + *
1270 1156 * @param measureInfoRequest
1271 1157 * @return
1272 1158 */
... ... @@ -1304,7 +1190,7 @@
1304 1190  
1305 1191 addToDataInfo(request);
1306 1192  
1307   - if(one != null) {
  1193 + if (one != null) {
1308 1194 one.setModified(new Date());
1309 1195 one.setBloodSugar(bloodSugar.getBloodSugar());
1310 1196 bloodSugarService.update(one);
... ... @@ -1331,8 +1217,7 @@
1331 1217 public BaseResponse updateMeasureFingerInfo(MeasureInfoRequest measureInfoRequest) {
1332 1218  
1333 1219 BaseResponse baseResponse = new BaseResponse();
1334   - try
1335   - {
  1220 + try {
1336 1221 MeasureUserInfoQuery queryUser = new MeasureUserInfoQuery();
1337 1222 queryUser.setCertNo(measureInfoRequest.getCertNo());
1338 1223 queryUser.setHospitalId(measureInfoRequest.getHospitalId());
... ... @@ -1345,9 +1230,7 @@
1345 1230 userModel.setModified(new Date());
1346 1231 mysqlMeasureUserInfoService.updateMeasureUserInfo(userModel);
1347 1232 }
1348   - }
1349   - catch (Exception e)
1350   - {
  1233 + } catch (Exception e) {
1351 1234 baseResponse.setErrorcode(ErrorCodeConstants.SYSTEM_ERROR);
1352 1235 baseResponse.setErrormsg(ErrorCodeConstants.SYSTEM_ERROR_DESCRIPTION);
1353 1236 return baseResponse;
1354 1237  
... ... @@ -1367,12 +1250,10 @@
1367 1250 BaseObjectResponse objectResponse = new BaseObjectResponse();
1368 1251  
1369 1252 //表示传递的是住院号
1370   - if ("1".equals(measureAllInfoRequest.getCertType()))
1371   - {
  1253 + if ("1".equals(measureAllInfoRequest.getCertType())) {
1372 1254 query.setZyNo(measureAllInfoRequest.getCertNo());
1373 1255 List<MeasureUserInfoModel> models = mysqlMeasureUserInfoService.queryMeasureUserInfoList(query);
1374   - if (CollectionUtils.isNotEmpty(models))
1375   - {
  1256 + if (CollectionUtils.isNotEmpty(models)) {
1376 1257 MeasureUserInfoModel userInfoModel = models.get(0);
1377 1258 result.setUserName(userInfoModel.getUserName());
1378 1259 result.setCertNo(userInfoModel.getCertNo());
1379 1260  
1380 1261  
1381 1262  
... ... @@ -1381,21 +1262,16 @@
1381 1262 result.setPhone(userInfoModel.getPhone());
1382 1263 result.setVcCardNo(userInfoModel.getVcCardNo());
1383 1264 result.setZyNo(userInfoModel.getZyNo());
1384   - }
1385   - else
1386   - {
  1265 + } else {
1387 1266 //住院号查询 住院的基本信息
1388   - if ("216".equals(measureAllInfoRequest.getHospitalId()))
1389   - {
  1267 + if ("216".equals(measureAllInfoRequest.getHospitalId())) {
1390 1268 result = getPatientZyInfo(" and INP_NO = '" + measureAllInfoRequest.getCertNo() + "'", "1", measureAllInfoRequest.getHospitalId());
1391 1269 }
1392 1270 query.setZyNo(null);
1393   - if (result != null && StringUtils.isNotEmpty(result.getCertNo()))
1394   - {
  1271 + if (result != null && StringUtils.isNotEmpty(result.getCertNo())) {
1395 1272 query.setCertNo(result.getCertNo());
1396 1273 List<MeasureUserInfoModel> userInfoModels = mysqlMeasureUserInfoService.queryMeasureUserInfoList(query);
1397   - if (CollectionUtils.isNotEmpty(userInfoModels))
1398   - {
  1274 + if (CollectionUtils.isNotEmpty(userInfoModels)) {
1399 1275 MeasureUserInfoModel userInfoModel = userInfoModels.get(0);
1400 1276 result.setUserName(userInfoModel.getUserName());
1401 1277 result.setCertNo(userInfoModel.getCertNo());
... ... @@ -1404,9 +1280,7 @@
1404 1280 result.setPhone(userInfoModel.getPhone());
1405 1281 result.setVcCardNo(userInfoModel.getVcCardNo());
1406 1282 result.setZyNo(userInfoModel.getZyNo());
1407   - }
1408   - else
1409   - {
  1283 + } else {
1410 1284 //创建随心测用户
1411 1285 MeasureUserInfoModel model = new MeasureUserInfoModel();
1412 1286 model.setUserName(result.getUserName());
1413 1287  
... ... @@ -1421,16 +1295,13 @@
1421 1295 model.setModified(new Date());
1422 1296 mysqlMeasureUserInfoService.addMeasureUserInfo(model);
1423 1297 }
1424   - }
1425   - else
1426   - {
  1298 + } else {
1427 1299 objectResponse.setErrorcode(ErrorCodeConstants.NO_DATA);
1428 1300 objectResponse.setErrormsg("没有建档数据,建档后测量");
1429 1301 return objectResponse;
1430 1302 }
1431 1303 }
1432   - }
1433   - else {
  1304 + } else {
1434 1305 query.setCertType(measureAllInfoRequest.getCertType());
1435 1306 query.setCertNo(measureAllInfoRequest.getCertNo());
1436 1307 List<MeasureUserInfoModel> models = mysqlMeasureUserInfoService.queryMeasureUserInfoList(query);
... ... @@ -1443,9 +1314,7 @@
1443 1314 result.setPhone(userInfoModel.getPhone());
1444 1315 result.setVcCardNo(userInfoModel.getVcCardNo());
1445 1316 result.setZyNo(userInfoModel.getZyNo());
1446   - }
1447   - else
1448   - {
  1317 + } else {
1449 1318 //查询院内系统信息 创建随心测用户
1450 1319 PatientsQuery patientsQuery = new PatientsQuery();
1451 1320 patientsQuery.setHospitalId(measureAllInfoRequest.getHospitalId());
1452 1321  
1453 1322  
... ... @@ -1478,16 +1347,12 @@
1478 1347 result.setZyNo(model.getZyNo());
1479 1348  
1480 1349 mysqlMeasureUserInfoService.addMeasureUserInfo(model);
1481   - }
1482   - else
1483   - {
  1350 + } else {
1484 1351  
1485   - if ("216".equals(measureAllInfoRequest.getHospitalId()))
1486   - {
1487   - result = getPatientZyInfo(" and ZJH='"+measureAllInfoRequest.getCertNo()+"'",measureAllInfoRequest.getCertType(),measureAllInfoRequest.getHospitalId());
  1352 + if ("216".equals(measureAllInfoRequest.getHospitalId())) {
  1353 + result = getPatientZyInfo(" and ZJH='" + measureAllInfoRequest.getCertNo() + "'", measureAllInfoRequest.getCertType(), measureAllInfoRequest.getHospitalId());
1488 1354 }
1489   - if (result != null && StringUtils.isNotEmpty(result.getCertNo()))
1490   - {
  1355 + if (result != null && StringUtils.isNotEmpty(result.getCertNo())) {
1491 1356 //创建随心测用户
1492 1357 MeasureUserInfoModel model = new MeasureUserInfoModel();
1493 1358 model.setUserName(result.getUserName());
... ... @@ -1510,9 +1375,7 @@
1510 1375 result.setVcCardNo(model.getVcCardNo());
1511 1376 result.setZyNo(model.getZyNo());
1512 1377  
1513   - }
1514   - else
1515   - {
  1378 + } else {
1516 1379 objectResponse.setErrorcode(ErrorCodeConstants.NO_DATA);
1517 1380 objectResponse.setErrormsg("没有建档数据,建档后测量");
1518 1381 return objectResponse;
1519 1382  
1520 1383  
... ... @@ -1533,18 +1396,14 @@
1533 1396 BabyModelQuery query = new BabyModelQuery();
1534 1397 query.setHospitalId(hospitalId);
1535 1398 query.setYn(YnEnums.YES.getId());
1536   - if ("1".equals(certType))
1537   - {
  1399 + if ("2".equals(certType)) {
1538 1400 query.setVcCardNo(certNo);
1539   - }
1540   - else
1541   - {
  1401 + } else {
1542 1402 query.setMcertNo(certNo);
1543 1403 }
1544 1404  
1545 1405 List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(query);
1546   - if (CollectionUtils.isEmpty(models))
1547   - {
  1406 + if (CollectionUtils.isEmpty(models)) {
1548 1407 br.setErrorcode(ErrorCodeConstants.USER_NOT_EXISTS);
1549 1408 br.setErrormsg("没有儿童档案,请到儿童中心创建档案");
1550 1409 return br;
1551 1410  
1552 1411  
1553 1412  
... ... @@ -1552,26 +1411,25 @@
1552 1411  
1553 1412 Map data = new HashMap();
1554 1413 Map mother = new HashMap();
1555   - mother.put("motherCardNo",models.get(0).getMcertNo());
1556   - mother.put("motherPhone",models.get(0).getMphone());
1557   - mother.put("motherName",models.get(0).getMname());
1558   - mother.put("motherAge",models.get(0).getMbirth() == null ? "" : DateUtil.getAge(models.get(0).getMbirth(), new Date()));
  1414 + mother.put("motherCardNo", models.get(0).getMcertNo());
  1415 + mother.put("motherPhone", models.get(0).getMphone());
  1416 + mother.put("motherName", models.get(0).getMname());
  1417 + mother.put("motherAge", models.get(0).getMbirth() == null ? "" : DateUtil.getAge(models.get(0).getMbirth(), new Date()));
1559 1418  
1560 1419 List<Map> babies = new ArrayList<>();
1561   - for (BabyModel baby : models)
1562   - {
  1420 + for (BabyModel baby : models) {
1563 1421 Map map = new HashMap();
1564   - map.put("id",baby.getId());
1565   - map.put("babyName",baby.getName());
1566   - map.put("sex",SexEnum.getTextById(baby.getSex()));
1567   - map.put("birth",DateUtil.getyyyy_MM_dd(baby.getBirth()));
1568   - map.put("vcCardNo",baby.getVcCardNo());
  1422 + map.put("id", baby.getId());
  1423 + map.put("babyName", baby.getName());
  1424 + map.put("sex", SexEnum.getTextById(baby.getSex()));
  1425 + map.put("birth", DateUtil.getyyyy_MM_dd(baby.getBirth()));
  1426 + map.put("vcCardNo", baby.getVcCardNo());
1569 1427  
1570 1428 babies.add(map);
1571 1429 }
1572 1430  
1573   - data.put("babies",babies);
1574   - data.put("mother",mother);
  1431 + data.put("babies", babies);
  1432 + data.put("mother", mother);
1575 1433  
1576 1434 br.setData(data);
1577 1435 return br;
1578 1436  
1579 1437  
... ... @@ -1583,17 +1441,14 @@
1583 1441 MeasureBabyInfoModel measureBabyInfoModel = measureBabyInfoRequest.convertToDataModel();
1584 1442 MeasureBabyDataInfoQuery query = new MeasureBabyDataInfoQuery();
1585 1443 query.setBabyId(measureBabyInfoRequest.getBabyId());
1586   - List<MeasureBabyInfoModel> models = mysqlMeasureDataInfoService.queryMeasureBabyInfoList(query);
  1444 + List<MeasureBabyInfoModel> models = mysqlMeasureDataInfoService.queryMeasureBabyInfoList(query);
1587 1445  
1588   - if (CollectionUtils.isNotEmpty(models))
1589   - {
  1446 + if (CollectionUtils.isNotEmpty(models)) {
1590 1447 int todayCount = 0;
1591 1448 MeasureBabyInfoModel model = models.get(0);
1592 1449 if (DateUtil.getyyyy_MM_dd(model.getModified()).equals(DateUtil.getyyyy_MM_dd(new Date()))) {
1593 1450 todayCount = model.getTodayCount() + 1;
1594   - }
1595   - else
1596   - {
  1451 + } else {
1597 1452 todayCount = 1;
1598 1453 }
1599 1454 model.setTodayCount(todayCount);
... ... @@ -1602,9 +1457,7 @@
1602 1457 model.setValueTwo(measureBabyInfoRequest.getValueTwo());
1603 1458 model.setModified(new Date());
1604 1459 mysqlMeasureDataInfoService.updateMeasureBabyDataInfo(model);
1605   - }
1606   - else
1607   - {
  1460 + } else {
1608 1461 measureBabyInfoModel.setModified(new Date());
1609 1462 measureBabyInfoModel.setTodayCount(1);
1610 1463 measureBabyInfoModel.setRecordCount(1);
1611 1464  
... ... @@ -1623,17 +1476,14 @@
1623 1476  
1624 1477  
1625 1478 List<String> babyIds = new ArrayList<>();
1626   - if (StringUtils.isNotEmpty(vcCardNo) || StringUtils.isNotEmpty(queryNo) )
1627   - {
  1479 + if (StringUtils.isNotEmpty(vcCardNo) || StringUtils.isNotEmpty(queryNo)) {
1628 1480 BabyModelQuery babyQuery = new BabyModelQuery();
1629 1481 babyQuery.setVcCardNo(vcCardNo);
1630 1482 babyQuery.setQueryNo(queryNo);
1631 1483  
1632   - List<BabyModel> babyModels = babyBookbuildingService.queryBabyBuildByCond(babyQuery);
1633   - if (CollectionUtils.isNotEmpty(babyModels))
1634   - {
1635   - for (BabyModel model : babyModels)
1636   - {
  1484 + List<BabyModel> babyModels = babyBookbuildingService.queryBabyBuildByCond(babyQuery);
  1485 + if (CollectionUtils.isNotEmpty(babyModels)) {
  1486 + for (BabyModel model : babyModels) {
1637 1487 babyIds.add(model.getId());
1638 1488 }
1639 1489 }
1640 1490  
... ... @@ -1658,26 +1508,23 @@
1658 1508  
1659 1509 List<Map> list = new ArrayList<>();
1660 1510  
1661   - List<MeasureBabyInfoModel> models = mysqlMeasureDataInfoService.queryMeasureBabyInfoList(query);
1662   - if (CollectionUtils.isNotEmpty(models))
1663   - {
1664   - for (MeasureBabyInfoModel model : models)
1665   - {
  1511 + List<MeasureBabyInfoModel> models = mysqlMeasureDataInfoService.queryMeasureBabyInfoList(query);
  1512 + if (CollectionUtils.isNotEmpty(models)) {
  1513 + for (MeasureBabyInfoModel model : models) {
1666 1514 Map map = new HashMap();
1667 1515  
1668 1516 BabyModel babyModel = babyBookbuildingService.queryBabyBuildById(model.getBabyId());
1669   - if (babyModel != null )
1670   - {
1671   - map.put("babyName",babyModel.getName());
1672   - map.put("sex",SexEnum.getTextById(babyModel.getSex()));
1673   - map.put("monthAge",DateUtil.getMonthDesc(babyModel.getBirth(), model.getModified()));
1674   - map.put("motherName",babyModel.getMname());
1675   - map.put("phone",babyModel.getMphone());
1676   - map.put("vcCardNo",babyModel.getVcCardNo());
1677   - map.put("weight",model.getValueOne());
1678   - map.put("height",model.getValueTwo());
1679   - map.put("recordTime",DateUtil.getyyyy_MM_dd(model.getModified()));
1680   - map.put("recordCount",model.getRecordCount());
  1517 + if (babyModel != null) {
  1518 + map.put("babyName", babyModel.getName());
  1519 + map.put("sex", SexEnum.getTextById(babyModel.getSex()));
  1520 + map.put("monthAge", DateUtil.getMonthDesc(babyModel.getBirth(), model.getModified()));
  1521 + map.put("motherName", babyModel.getMname());
  1522 + map.put("phone", babyModel.getMphone());
  1523 + map.put("vcCardNo", babyModel.getVcCardNo());
  1524 + map.put("weight", model.getValueOne());
  1525 + map.put("height", model.getValueTwo());
  1526 + map.put("recordTime", DateUtil.getyyyy_MM_dd(model.getModified()));
  1527 + map.put("recordCount", model.getRecordCount());
1681 1528  
1682 1529 String hospital = "";
1683 1530 if (org.apache.commons.lang.StringUtils.isNotEmpty(model.getHospitalId())) {
... ... @@ -1686,7 +1533,7 @@
1686 1533 hospital = organization.getName();
1687 1534 }
1688 1535 }
1689   - map.put("hospialName",hospital);
  1536 + map.put("hospialName", hospital);
1690 1537 list.add(map);
1691 1538 }
1692 1539 }