Commit 612e6e99fab52a5232c11908d22b3d71585d6773

Authored by cfl
1 parent 0de307e70a
Exists in master and in 2 other branches dev, luanping

解决产检数据空的问题

Showing 1 changed file with 190 additions and 20 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RemoteController.java View file @ 612e6e9
... ... @@ -306,6 +306,177 @@
306 306 writeString(response,"success");
307 307 }
308 308  
  309 + @RequestMapping(value = "/confirmArchiveTest")
  310 + public void test(String idCard,String assistUserId){
  311 + ArchiveDataQuery query = new ArchiveDataQuery();
  312 + query.setIdCard(idCard);
  313 + List<ArchiveData> list = archiveDataServicer.query(query.convertToQuery());
  314 + if (CollectionUtils.isNotEmpty(list)) {
  315 + Map map = JsonUtil.str2Obj(list.get(0).getJsonData(), HashMap.class);
  316 + String history1 = JsonUtil.obj2JsonString(map.get("history"));
  317 + Map<String, Object> history = JsonUtil.str2Obj(history1, Map.class);
  318 +
  319 + PatientsQuery patientsQuery = new PatientsQuery();
  320 + patientsQuery.setYn(YnEnums.YES.getId());
  321 + patientsQuery.setType(1);
  322 + patientsQuery.setCardNo(idCard);
  323 + patientsQuery.setDesc("true");
  324 + patientsQuery.setSort("created");
  325 + List<Patients> patientsList = patientsService.queryPatient(patientsQuery);
  326 + Patients patients = patientsList.get(0);
  327 +
  328 + AntExcAddRequest antExcAddRequest = new AntExcAddRequest();
  329 + antExcAddRequest.setOperaterUserId(assistUserId);
  330 + antExcAddRequest.setPid(patients.getPid());
  331 + antExcAddRequest.setParentId(patients.getId());
  332 + antExcAddRequest.setName(patients.getUsername());
  333 + antExcAddRequest.setCheckTime(DateUtil.getyyyy_MM_dd_hms(new Date()));
  334 + antExcAddRequest.setProdDoctor(assistUserId);
  335 + //antExcAddRequest.setcDueWeek(cDueWeek);
  336 +
  337 + if (history.get("bp") != null) {
  338 + String bp = JsonUtil.obj2JsonString(history.get("bp"));
  339 + antExcAddRequest.setBp(JsonUtil.str2Obj(bp, Map.class));
  340 + }
  341 + // 既往史
  342 + if (history.get("pastHistory") != null) {
  343 + String pastHistory = JsonUtil.obj2JsonString(history.get("pastHistory"));
  344 + if (StringUtils.isNotEmpty(pastHistory)) {
  345 + Map pastHistoryMap = JsonUtil.jkstr2Obj(pastHistory, Map.class);
  346 + antExcAddRequest.setPastHistory(pastHistoryMap);
  347 + }
  348 + }
  349 + // 家族史
  350 + if (history.get("familyHistory") != null) {
  351 + String familyHistory = JsonUtil.obj2JsonString(history.get("familyHistory"));
  352 + if (StringUtils.isNotEmpty(familyHistory)) {
  353 + Map familyHistoryMap = JsonUtil.jkstr2Obj(familyHistory, Map.class);
  354 + antExcAddRequest.setFamilyHistory(familyHistoryMap);
  355 + }
  356 + }
  357 + //个人史
  358 + if (history.get("personalHistory") != null) {
  359 + String personalHistory = JsonUtil.obj2JsonString(history.get("personalHistory"));
  360 + if (StringUtils.isNotEmpty(personalHistory)) {
  361 + Map personalHistoryMap = JsonUtil.jkstr2Obj(personalHistory, Map.class);
  362 + antExcAddRequest.setPersonalHistory(personalHistoryMap);
  363 + }
  364 + }
  365 + //妇科手术史
  366 + if (history.get("fksxHistory") != null) {
  367 + String fksxHistory = JsonUtil.obj2JsonString(history.get("fksxHistory"));
  368 + if (StringUtils.isNotEmpty(fksxHistory)) {
  369 + Map fksxHistoryMap = JsonUtil.jkstr2Obj(fksxHistory, Map.class);
  370 + antExcAddRequest.setFksxHistory(fksxHistoryMap);
  371 + }
  372 + }
  373 + //本次妊娠情况
  374 + if (history.get("cestationInfo") != null) {
  375 + String cestationInfo = JsonUtil.obj2JsonString(history.get("cestationInfo"));
  376 + if (StringUtils.isNotEmpty(cestationInfo)) {
  377 + Map cestationInfoMap = JsonUtil.jkstr2Obj(cestationInfo, Map.class);
  378 + antExcAddRequest.setCestationInfo(cestationInfoMap);
  379 + }
  380 + }
  381 + //叶酸服用情况
  382 + if (history.get("ysfyHistory") != null) {
  383 + String ysfyHistory = JsonUtil.obj2JsonString(history.get("ysfyHistory"));
  384 + if (StringUtils.isNotEmpty(ysfyHistory)) {
  385 + Map ysfyHistoryMap = JsonUtil.jkstr2Obj(ysfyHistory, Map.class);
  386 + antExcAddRequest.setYsfyHistory(ysfyHistoryMap);
  387 + }
  388 + }
  389 + //传染病史
  390 + if (history.get("infectDiseases") != null) {
  391 + String infectDiseases = JsonUtil.obj2JsonString(history.get("infectDiseases"));
  392 + if (StringUtils.isNotEmpty(infectDiseases)) {
  393 + Map infectDiseasesMap = JsonUtil.jkstr2Obj(infectDiseases, Map.class);
  394 + antExcAddRequest.setInfectDiseases(infectDiseasesMap);
  395 + }
  396 + }
  397 +
  398 + //剖宫产次数
  399 + if (isNotNull(history.get("planedProd"))) {
  400 + antExcAddRequest.setPlanedProd((Integer) history.get("planedProd"));
  401 + }
  402 + //顺产次数
  403 + if (isNotNull(history.get("delivery"))) {
  404 + antExcAddRequest.setDelivery((Integer) history.get("delivery"));
  405 + }
  406 + //引产次数
  407 + if (isNotNull(history.get("yinchan"))) {
  408 + antExcAddRequest.setYinchan((Integer) history.get("yinchan"));
  409 + }
  410 + //流产
  411 + if (isNotNull(history.get("abortion"))) {
  412 + antExcAddRequest.setAbortion((Integer) history.get("abortion"));
  413 + }
  414 + //自然流产
  415 + if (isNotNull(history.get("abortionZR"))) {
  416 + antExcAddRequest.setAbortionZR((Integer) history.get("abortionZR"));
  417 + }
  418 + //人工流产
  419 + if (isNotNull(history.get("abortionRG"))) {
  420 + antExcAddRequest.setAbortionRG((Integer) history.get("abortionRG"));
  421 + }
  422 + //药物流产
  423 + if (isNotNull(history.get("yaowu"))) {
  424 + antExcAddRequest.setYaowu((Integer) history.get("yaowu"));
  425 + }
  426 +
  427 + //孕次
  428 + if (isNotNull(history.get("pregnancyTimes"))) {
  429 + antExcAddRequest.setPregnancyTimes((Integer) history.get("pregnancyTimes"));
  430 + }
  431 + //产次
  432 + antExcAddRequest.setProdTime((antExcAddRequest.getDelivery() != null ? antExcAddRequest.getDelivery() : 0)
  433 + + (antExcAddRequest.getPlanedProd() != null ? antExcAddRequest.getPlanedProd() : 0)
  434 + + (antExcAddRequest.getYinchan() != null ? antExcAddRequest.getYinchan() : 0)
  435 + + (antExcAddRequest.getAbortion() != null ? antExcAddRequest.getAbortion() : 0)
  436 + );
  437 +
  438 + if (isNotNull(history.get("yqWeight"))) {
  439 + antExcAddRequest.setYqweight(history.get("yqWeight").toString());
  440 + antExcAddRequest.setYqWeight(history.get("yqWeight").toString());
  441 + }
  442 + if (isNotNull(history.get("weight"))) {
  443 + antExcAddRequest.setWeight(history.get("weight").toString());
  444 + ;
  445 + }
  446 + if (isNotNull(history.get("height"))) {
  447 + antExcAddRequest.setHeight(history.get("height").toString());
  448 + }
  449 + if (StringUtils.isNotEmpty(antExcAddRequest.getWeight()) && StringUtils.isNotEmpty(antExcAddRequest.getHeight())) {
  450 + Double wh = Double.parseDouble(antExcAddRequest.getHeight()) / 100;
  451 + Double shen = wh * wh;
  452 + Double bmi = Double.parseDouble(antExcAddRequest.getWeight()) / shen;
  453 + antExcAddRequest.setBaricIndex(bmi + "");
  454 + }
  455 + //指导意见
  456 + GuidelinesQuery guidelinesQuery = new GuidelinesQuery();
  457 + guidelinesQuery.setType(1);
  458 + guidelinesQuery.setMaxStart(5);
  459 + guidelinesQuery.setMinEnd(5);
  460 + List<Guidelines> guidelines = guidelinesService.queryGuidelines(guidelinesQuery);
  461 + StringBuilder stringBuilder = new StringBuilder(128);
  462 + if (CollectionUtils.isNotEmpty(list)) {
  463 + for (Guidelines guideline : guidelines) {
  464 + stringBuilder.append(guideline.getCategory()).append(" ").append(guideline.getContent()).append("\r\n");
  465 + }
  466 + antExcAddRequest.setGuide(stringBuilder.toString());
  467 + }
  468 +
  469 + BaseResponse baseResponse = antenatalExaminationFacade.addOneAnetExChu(antExcAddRequest, Integer.valueOf(assistUserId));
  470 + System.out.println("auto generate antexc end," + baseResponse.toString());
  471 + }
  472 + }
  473 +
  474 + private boolean isNotNull(Object o){
  475 + return o != null
  476 + && !"null".equals(o.toString())
  477 + && !"".equals(o.toString());
  478 + }
  479 +
309 480 /**
310 481 * 小程序预约直接建档
311 482 * @param response
312 483  
... ... @@ -392,12 +563,12 @@
392 563 antExcAddRequest.setProdDoctor(assistUserId);
393 564 antExcAddRequest.setcDueWeek(cDueWeek);
394 565  
395   - if (history.get("bp") != null) {
  566 + if (isNotNull(history.get("bp"))) {
396 567 String bp = JsonUtil.obj2JsonString(history.get("bp"));
397 568 antExcAddRequest.setBp(JsonUtil.str2Obj(bp, Map.class));
398 569 }
399 570 // 既往史
400   - if (history.get("pastHistory") != null) {
  571 + if (isNotNull(history.get("pastHistory"))) {
401 572 String pastHistory = JsonUtil.obj2JsonString(history.get("pastHistory"));
402 573 if (StringUtils.isNotEmpty(pastHistory)) {
403 574 Map pastHistoryMap = JsonUtil.jkstr2Obj(pastHistory, Map.class);
... ... @@ -405,7 +576,7 @@
405 576 }
406 577 }
407 578 // 家族史
408   - if (history.get("familyHistory") != null) {
  579 + if (isNotNull(history.get("familyHistory"))) {
409 580 String familyHistory = JsonUtil.obj2JsonString(history.get("familyHistory"));
410 581 if (StringUtils.isNotEmpty(familyHistory)) {
411 582 Map familyHistoryMap = JsonUtil.jkstr2Obj(familyHistory, Map.class);
... ... @@ -413,7 +584,7 @@
413 584 }
414 585 }
415 586 //个人史
416   - if (history.get("personalHistory") != null) {
  587 + if (isNotNull(history.get("personalHistory"))) {
417 588 String personalHistory = JsonUtil.obj2JsonString(history.get("personalHistory"));
418 589 if (StringUtils.isNotEmpty(personalHistory)) {
419 590 Map personalHistoryMap = JsonUtil.jkstr2Obj(personalHistory, Map.class);
... ... @@ -421,7 +592,7 @@
421 592 }
422 593 }
423 594 //妇科手术史
424   - if (history.get("fksxHistory") != null) {
  595 + if (isNotNull(history.get("fksxHistory"))) {
425 596 String fksxHistory = JsonUtil.obj2JsonString(history.get("fksxHistory"));
426 597 if (StringUtils.isNotEmpty(fksxHistory)) {
427 598 Map fksxHistoryMap = JsonUtil.jkstr2Obj(fksxHistory, Map.class);
... ... @@ -429,7 +600,7 @@
429 600 }
430 601 }
431 602 //本次妊娠情况
432   - if (history.get("cestationInfo") != null) {
  603 + if (isNotNull(history.get("cestationInfo"))) {
433 604 String cestationInfo = JsonUtil.obj2JsonString(history.get("cestationInfo"));
434 605 if (StringUtils.isNotEmpty(cestationInfo)) {
435 606 Map cestationInfoMap = JsonUtil.jkstr2Obj(cestationInfo, Map.class);
... ... @@ -437,7 +608,7 @@
437 608 }
438 609 }
439 610 //叶酸服用情况
440   - if (history.get("ysfyHistory") != null) {
  611 + if (isNotNull(history.get("ysfyHistory") )) {
441 612 String ysfyHistory = JsonUtil.obj2JsonString(history.get("ysfyHistory"));
442 613 if (StringUtils.isNotEmpty(ysfyHistory)) {
443 614 Map ysfyHistoryMap = JsonUtil.jkstr2Obj(ysfyHistory, Map.class);
... ... @@ -445,7 +616,7 @@
445 616 }
446 617 }
447 618 //传染病史
448   - if (history.get("infectDiseases") != null) {
  619 + if (isNotNull(history.get("infectDiseases"))) {
449 620 String infectDiseases = JsonUtil.obj2JsonString(history.get("infectDiseases"));
450 621 if (StringUtils.isNotEmpty(infectDiseases)) {
451 622 Map infectDiseasesMap = JsonUtil.jkstr2Obj(infectDiseases, Map.class);
452 623  
453 624  
454 625  
455 626  
456 627  
457 628  
458 629  
... ... @@ -454,36 +625,36 @@
454 625 }
455 626  
456 627 //剖宫产次数
457   - if (history.get("planedProd") != null) {
  628 + if (isNotNull(history.get("planedProd"))) {
458 629 antExcAddRequest.setPlanedProd((Integer) history.get("planedProd"));
459 630 }
460 631 //顺产次数
461   - if (history.get("delivery") != null) {
  632 + if (isNotNull(history.get("delivery"))) {
462 633 antExcAddRequest.setDelivery((Integer) history.get("delivery"));
463 634 }
464 635 //引产次数
465   - if (history.get("yinchan") != null) {
  636 + if (isNotNull(history.get("yinchan"))) {
466 637 antExcAddRequest.setYinchan((Integer) history.get("yinchan"));
467 638 }
468 639 //流产
469   - if (history.get("abortion") != null) {
  640 + if (isNotNull(history.get("abortion"))) {
470 641 antExcAddRequest.setAbortion((Integer) history.get("abortion"));
471 642 }
472 643 //自然流产
473   - if (history.get("abortionZR") != null) {
  644 + if (isNotNull(history.get("abortionZR"))) {
474 645 antExcAddRequest.setAbortionZR((Integer) history.get("abortionZR"));
475 646 }
476 647 //人工流产
477   - if (history.get("abortionRG") != null) {
  648 + if (isNotNull(history.get("abortionRG"))) {
478 649 antExcAddRequest.setAbortionRG((Integer) history.get("abortionRG"));
479 650 }
480 651 //药物流产
481   - if (history.get("yaowu") != null) {
  652 + if (isNotNull(history.get("yaowu"))) {
482 653 antExcAddRequest.setYaowu((Integer) history.get("yaowu"));
483 654 }
484 655  
485 656 //孕次
486   - if (history.get("pregnancyTimes") != null) {
  657 + if (isNotNull(history.get("pregnancyTimes"))) {
487 658 antExcAddRequest.setPregnancyTimes((Integer) history.get("pregnancyTimes"));
488 659 }
489 660 //产次
490 661  
491 662  
492 663  
... ... @@ -493,15 +664,14 @@
493 664 + (antExcAddRequest.getAbortion() != null ? antExcAddRequest.getAbortion() : 0)
494 665 );
495 666  
496   - if (history.get("yqWeight") != null) {
  667 + if (isNotNull(history.get("yqWeight"))) {
497 668 antExcAddRequest.setYqweight(history.get("yqWeight").toString());
498 669 antExcAddRequest.setYqWeight(history.get("yqWeight").toString());
499 670 }
500   - if (history.get("weight") != null) {
  671 + if (isNotNull(history.get("weight"))) {
501 672 antExcAddRequest.setWeight(history.get("weight").toString());
502   - ;
503 673 }
504   - if (history.get("height") != null) {
  674 + if (isNotNull(history.get("height"))) {
505 675 antExcAddRequest.setHeight(history.get("height").toString());
506 676 }
507 677 if (StringUtils.isNotEmpty(antExcAddRequest.getWeight()) && StringUtils.isNotEmpty(antExcAddRequest.getHeight())) {