Commit d0fc07c9179e5f124659674a6ab9468be84051f9

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

增加自动建档生成初检记录功能bug修改

Showing 1 changed file with 161 additions and 159 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RemoteController.java View file @ d0fc07c
... ... @@ -358,179 +358,181 @@
358 358 final String cDueWeek = request.getcDueWeek();
359 359  
360 360 BaseObjectResponse baseObjectResponse = bookbuildingFacade.addPregnantBookbuilding(request, Integer.valueOf(archiveUsers.getAssistUserId()), false);
361   - new Thread(new Runnable() {
362   - @Override
363   - public void run() {
364   - System.out.println("start auto generate antexc......");
365   - try {
366   - //查询预约建档信息
367   - ArchiveDataQuery query = new ArchiveDataQuery();
368   - query.setIdCard(idCard);
369   - List<ArchiveData> list = archiveDataServicer.query(query.convertToQuery());
370   - if (CollectionUtils.isNotEmpty(list)) {
371   - Map map = JsonUtil.str2Obj(list.get(0).getJsonData(), HashMap.class);
372   - String history1 = JsonUtil.obj2JsonString(map.get("history"));
373   - Map<String, Object> history = JsonUtil.str2Obj(history1,Map.class) ;
  361 + System.out.println("confirmArchive return :"+JsonUtil.obj2JsonString(baseObjectResponse));
  362 + if(baseObjectResponse.getErrorcode()==ErrorCodeConstants.SUCCESS){
  363 + new Thread(new Runnable() {
  364 + @Override
  365 + public void run() {
  366 + System.out.println("start auto generate antexc......");
  367 + try {
  368 + //查询预约建档信息
  369 + ArchiveDataQuery query = new ArchiveDataQuery();
  370 + query.setIdCard(idCard);
  371 + List<ArchiveData> list = archiveDataServicer.query(query.convertToQuery());
  372 + if (CollectionUtils.isNotEmpty(list)) {
  373 + Map map = JsonUtil.str2Obj(list.get(0).getJsonData(), HashMap.class);
  374 + String history1 = JsonUtil.obj2JsonString(map.get("history"));
  375 + Map<String, Object> history = JsonUtil.str2Obj(history1,Map.class) ;
374 376  
375   - PatientsQuery patientsQuery = new PatientsQuery();
376   - patientsQuery.setYn(YnEnums.YES.getId());
377   - patientsQuery.setType(1);
378   - patientsQuery.setCardNo(idCard);
379   - List<Patients> patientsList = patientsService.queryPatient(patientsQuery);
380   - Patients patients = patientsList.get(0);
  377 + PatientsQuery patientsQuery = new PatientsQuery();
  378 + patientsQuery.setYn(YnEnums.YES.getId());
  379 + patientsQuery.setType(1);
  380 + patientsQuery.setCardNo(idCard);
  381 + patientsQuery.setDesc("true");
  382 + patientsQuery.setSort("created");
  383 + List<Patients> patientsList = patientsService.queryPatient(patientsQuery);
  384 + Patients patients = patientsList.get(0);
381 385  
382   - AntExcAddRequest antExcAddRequest = new AntExcAddRequest();
383   - antExcAddRequest.setOperaterUserId(assistUserId);
384   - antExcAddRequest.setPid(patients.getPid());
385   - antExcAddRequest.setParentId(patients.getId());
386   - antExcAddRequest.setName(patients.getUsername());
387   - antExcAddRequest.setCheckTime(DateUtil.getyyyy_MM_dd_hms(new Date()));
388   - antExcAddRequest.setProdDoctor(assistUserId);
389   - antExcAddRequest.setcDueWeek(cDueWeek);
  386 + AntExcAddRequest antExcAddRequest = new AntExcAddRequest();
  387 + antExcAddRequest.setOperaterUserId(assistUserId);
  388 + antExcAddRequest.setPid(patients.getPid());
  389 + antExcAddRequest.setParentId(patients.getId());
  390 + antExcAddRequest.setName(patients.getUsername());
  391 + antExcAddRequest.setCheckTime(DateUtil.getyyyy_MM_dd_hms(new Date()));
  392 + antExcAddRequest.setProdDoctor(assistUserId);
  393 + antExcAddRequest.setcDueWeek(cDueWeek);
390 394  
391   - if (history.get("bp") != null) {
392   - String bp = JsonUtil.obj2JsonString(history.get("bp"));
393   - antExcAddRequest.setBp(JsonUtil.str2Obj(bp, Map.class));
394   - }
395   - // 既往史
396   - if (history.get("pastHistory") != null) {
397   - String pastHistory = JsonUtil.obj2JsonString(history.get("pastHistory"));
398   - if (StringUtils.isNotEmpty(pastHistory)) {
399   - Map pastHistoryMap = JsonUtil.jkstr2Obj(pastHistory, Map.class);
400   - antExcAddRequest.setPastHistory(pastHistoryMap);
  395 + if (history.get("bp") != null) {
  396 + String bp = JsonUtil.obj2JsonString(history.get("bp"));
  397 + antExcAddRequest.setBp(JsonUtil.str2Obj(bp, Map.class));
401 398 }
402   - }
403   - // 家族史
404   - if (history.get("familyHistory") != null) {
405   - String familyHistory = JsonUtil.obj2JsonString(history.get("familyHistory"));
406   - if (StringUtils.isNotEmpty(familyHistory)) {
407   - Map familyHistoryMap = JsonUtil.jkstr2Obj(familyHistory, Map.class);
408   - antExcAddRequest.setFamilyHistory(familyHistoryMap);
  399 + // 既往史
  400 + if (history.get("pastHistory") != null) {
  401 + String pastHistory = JsonUtil.obj2JsonString(history.get("pastHistory"));
  402 + if (StringUtils.isNotEmpty(pastHistory)) {
  403 + Map pastHistoryMap = JsonUtil.jkstr2Obj(pastHistory, Map.class);
  404 + antExcAddRequest.setPastHistory(pastHistoryMap);
  405 + }
409 406 }
410   - }
411   - //个人史
412   - if (history.get("personalHistory") != null) {
413   - String personalHistory = JsonUtil.obj2JsonString(history.get("personalHistory"));
414   - if (StringUtils.isNotEmpty(personalHistory)) {
415   - Map personalHistoryMap = JsonUtil.jkstr2Obj(personalHistory, Map.class);
416   - antExcAddRequest.setPersonalHistory(personalHistoryMap);
  407 + // 家族史
  408 + if (history.get("familyHistory") != null) {
  409 + String familyHistory = JsonUtil.obj2JsonString(history.get("familyHistory"));
  410 + if (StringUtils.isNotEmpty(familyHistory)) {
  411 + Map familyHistoryMap = JsonUtil.jkstr2Obj(familyHistory, Map.class);
  412 + antExcAddRequest.setFamilyHistory(familyHistoryMap);
  413 + }
417 414 }
418   - }
419   - //妇科手术史
420   - if (history.get("fksxHistory") != null) {
421   - String fksxHistory = JsonUtil.obj2JsonString(history.get("fksxHistory"));
422   - if (StringUtils.isNotEmpty(fksxHistory)) {
423   - Map fksxHistoryMap = JsonUtil.jkstr2Obj(fksxHistory, Map.class);
424   - antExcAddRequest.setFksxHistory(fksxHistoryMap);
  415 + //个人史
  416 + if (history.get("personalHistory") != null) {
  417 + String personalHistory = JsonUtil.obj2JsonString(history.get("personalHistory"));
  418 + if (StringUtils.isNotEmpty(personalHistory)) {
  419 + Map personalHistoryMap = JsonUtil.jkstr2Obj(personalHistory, Map.class);
  420 + antExcAddRequest.setPersonalHistory(personalHistoryMap);
  421 + }
425 422 }
426   - }
427   - //本次妊娠情况
428   - if (history.get("cestationInfo") != null) {
429   - String cestationInfo = JsonUtil.obj2JsonString(history.get("cestationInfo"));
430   - if (StringUtils.isNotEmpty(cestationInfo)) {
431   - Map cestationInfoMap = JsonUtil.jkstr2Obj(cestationInfo, Map.class);
432   - antExcAddRequest.setCestationInfo(cestationInfoMap);
  423 + //妇科手术史
  424 + if (history.get("fksxHistory") != null) {
  425 + String fksxHistory = JsonUtil.obj2JsonString(history.get("fksxHistory"));
  426 + if (StringUtils.isNotEmpty(fksxHistory)) {
  427 + Map fksxHistoryMap = JsonUtil.jkstr2Obj(fksxHistory, Map.class);
  428 + antExcAddRequest.setFksxHistory(fksxHistoryMap);
  429 + }
433 430 }
434   - }
435   - //叶酸服用情况
436   - if (history.get("ysfyHistory") != null) {
437   - String ysfyHistory = JsonUtil.obj2JsonString(history.get("ysfyHistory"));
438   - if (StringUtils.isNotEmpty(ysfyHistory)) {
439   - Map ysfyHistoryMap = JsonUtil.jkstr2Obj(ysfyHistory, Map.class);
440   - antExcAddRequest.setYsfyHistory(ysfyHistoryMap);
  431 + //本次妊娠情况
  432 + if (history.get("cestationInfo") != null) {
  433 + String cestationInfo = JsonUtil.obj2JsonString(history.get("cestationInfo"));
  434 + if (StringUtils.isNotEmpty(cestationInfo)) {
  435 + Map cestationInfoMap = JsonUtil.jkstr2Obj(cestationInfo, Map.class);
  436 + antExcAddRequest.setCestationInfo(cestationInfoMap);
  437 + }
441 438 }
442   - }
443   - //传染病史
444   - if (history.get("infectDiseases") != null) {
445   - String infectDiseases = JsonUtil.obj2JsonString(history.get("infectDiseases"));
446   - if (StringUtils.isNotEmpty(infectDiseases)) {
447   - Map infectDiseasesMap = JsonUtil.jkstr2Obj(infectDiseases, Map.class);
448   - antExcAddRequest.setInfectDiseases(infectDiseasesMap);
  439 + //叶酸服用情况
  440 + if (history.get("ysfyHistory") != null) {
  441 + String ysfyHistory = JsonUtil.obj2JsonString(history.get("ysfyHistory"));
  442 + if (StringUtils.isNotEmpty(ysfyHistory)) {
  443 + Map ysfyHistoryMap = JsonUtil.jkstr2Obj(ysfyHistory, Map.class);
  444 + antExcAddRequest.setYsfyHistory(ysfyHistoryMap);
  445 + }
449 446 }
450   - }
  447 + //传染病史
  448 + if (history.get("infectDiseases") != null) {
  449 + String infectDiseases = JsonUtil.obj2JsonString(history.get("infectDiseases"));
  450 + if (StringUtils.isNotEmpty(infectDiseases)) {
  451 + Map infectDiseasesMap = JsonUtil.jkstr2Obj(infectDiseases, Map.class);
  452 + antExcAddRequest.setInfectDiseases(infectDiseasesMap);
  453 + }
  454 + }
451 455  
452   - //剖宫产次数
453   - if (history.get("planedProd") != null) {
454   - antExcAddRequest.setPlanedProd((Integer) history.get("planedProd"));
455   - }
456   - //顺产次数
457   - if (history.get("delivery") != null) {
458   - antExcAddRequest.setDelivery((Integer) history.get("delivery"));
459   - }
460   - //引产次数
461   - if (history.get("yinchan") != null) {
462   - antExcAddRequest.setYinchan((Integer) history.get("yinchan"));
463   - }
464   - //流产
465   - if (history.get("abortion") != null) {
466   - antExcAddRequest.setAbortion((Integer) history.get("abortion"));
467   - }
468   - //自然流产
469   - if (history.get("abortionZR") != null) {
470   - antExcAddRequest.setAbortionZR((Integer) history.get("abortionZR"));
471   - }
472   - //人工流产
473   - if (history.get("abortionRG") != null) {
474   - antExcAddRequest.setAbortionRG((Integer) history.get("abortionRG"));
475   - }
476   - //药物流产
477   - if (history.get("yaowu") != null) {
478   - antExcAddRequest.setYaowu((Integer) history.get("yaowu"));
479   - }
  456 + //剖宫产次数
  457 + if (history.get("planedProd") != null) {
  458 + antExcAddRequest.setPlanedProd((Integer) history.get("planedProd"));
  459 + }
  460 + //顺产次数
  461 + if (history.get("delivery") != null) {
  462 + antExcAddRequest.setDelivery((Integer) history.get("delivery"));
  463 + }
  464 + //引产次数
  465 + if (history.get("yinchan") != null) {
  466 + antExcAddRequest.setYinchan((Integer) history.get("yinchan"));
  467 + }
  468 + //流产
  469 + if (history.get("abortion") != null) {
  470 + antExcAddRequest.setAbortion((Integer) history.get("abortion"));
  471 + }
  472 + //自然流产
  473 + if (history.get("abortionZR") != null) {
  474 + antExcAddRequest.setAbortionZR((Integer) history.get("abortionZR"));
  475 + }
  476 + //人工流产
  477 + if (history.get("abortionRG") != null) {
  478 + antExcAddRequest.setAbortionRG((Integer) history.get("abortionRG"));
  479 + }
  480 + //药物流产
  481 + if (history.get("yaowu") != null) {
  482 + antExcAddRequest.setYaowu((Integer) history.get("yaowu"));
  483 + }
480 484  
481   - //孕次
482   - if (history.get("pregnancyTimes") != null) {
483   - antExcAddRequest.setPregnancyTimes((Integer) history.get("pregnancyTimes"));
484   - }
485   - //产次
486   - antExcAddRequest.setProdTime((antExcAddRequest.getDelivery() != null ? antExcAddRequest.getDelivery() : 0)
487   - + (antExcAddRequest.getPlanedProd() != null ? antExcAddRequest.getPlanedProd() : 0)
488   - + (antExcAddRequest.getYinchan() != null ? antExcAddRequest.getYinchan() : 0)
489   - + (antExcAddRequest.getAbortion() != null ? antExcAddRequest.getAbortion() : 0)
490   - );
  485 + //孕次
  486 + if (history.get("pregnancyTimes") != null) {
  487 + antExcAddRequest.setPregnancyTimes((Integer) history.get("pregnancyTimes"));
  488 + }
  489 + //产次
  490 + antExcAddRequest.setProdTime((antExcAddRequest.getDelivery() != null ? antExcAddRequest.getDelivery() : 0)
  491 + + (antExcAddRequest.getPlanedProd() != null ? antExcAddRequest.getPlanedProd() : 0)
  492 + + (antExcAddRequest.getYinchan() != null ? antExcAddRequest.getYinchan() : 0)
  493 + + (antExcAddRequest.getAbortion() != null ? antExcAddRequest.getAbortion() : 0)
  494 + );
491 495  
492   - if (history.get("yqWeight") != null) {
493   - antExcAddRequest.setYqweight(history.get("yqWeight").toString());
494   - antExcAddRequest.setYqWeight(history.get("yqWeight").toString());
495   - }
496   - if (history.get("weight") != null) {
497   - antExcAddRequest.setWeight(history.get("weight").toString());
498   - ;
499   - }
500   - if (history.get("height") != null) {
501   - antExcAddRequest.setHeight(history.get("height").toString());
502   - }
503   - if (StringUtils.isNotEmpty(antExcAddRequest.getWeight()) && StringUtils.isNotEmpty(antExcAddRequest.getHeight())) {
504   - Double wh = Double.parseDouble(antExcAddRequest.getHeight()) / 100;
505   - Double shen = wh * wh;
506   - Double bmi = Double.parseDouble(antExcAddRequest.getWeight()) / shen;
507   - antExcAddRequest.setBaricIndex(bmi + "");
508   - }
509   - //指导意见
510   - GuidelinesQuery guidelinesQuery = new GuidelinesQuery();
511   - guidelinesQuery.setType(1);
512   - guidelinesQuery.setMaxStart(5);
513   - guidelinesQuery.setMinEnd(5);
514   - List<Guidelines> guidelines = guidelinesService.queryGuidelines(guidelinesQuery);
515   - StringBuilder stringBuilder = new StringBuilder(128);
516   - if (CollectionUtils.isNotEmpty(list)) {
517   - for (Guidelines guideline : guidelines) {
518   - stringBuilder.append(guideline.getCategory()).append(" ").append(guideline.getContent()).append("\r\n");
  496 + if (history.get("yqWeight") != null) {
  497 + antExcAddRequest.setYqweight(history.get("yqWeight").toString());
  498 + antExcAddRequest.setYqWeight(history.get("yqWeight").toString());
519 499 }
520   - antExcAddRequest.setGuide(stringBuilder.toString());
521   - }
  500 + if (history.get("weight") != null) {
  501 + antExcAddRequest.setWeight(history.get("weight").toString());
  502 + ;
  503 + }
  504 + if (history.get("height") != null) {
  505 + antExcAddRequest.setHeight(history.get("height").toString());
  506 + }
  507 + if (StringUtils.isNotEmpty(antExcAddRequest.getWeight()) && StringUtils.isNotEmpty(antExcAddRequest.getHeight())) {
  508 + Double wh = Double.parseDouble(antExcAddRequest.getHeight()) / 100;
  509 + Double shen = wh * wh;
  510 + Double bmi = Double.parseDouble(antExcAddRequest.getWeight()) / shen;
  511 + antExcAddRequest.setBaricIndex(bmi + "");
  512 + }
  513 + //指导意见
  514 + GuidelinesQuery guidelinesQuery = new GuidelinesQuery();
  515 + guidelinesQuery.setType(1);
  516 + guidelinesQuery.setMaxStart(5);
  517 + guidelinesQuery.setMinEnd(5);
  518 + List<Guidelines> guidelines = guidelinesService.queryGuidelines(guidelinesQuery);
  519 + StringBuilder stringBuilder = new StringBuilder(128);
  520 + if (CollectionUtils.isNotEmpty(list)) {
  521 + for (Guidelines guideline : guidelines) {
  522 + stringBuilder.append(guideline.getCategory()).append(" ").append(guideline.getContent()).append("\r\n");
  523 + }
  524 + antExcAddRequest.setGuide(stringBuilder.toString());
  525 + }
522 526  
523   - BaseResponse baseResponse = antenatalExaminationFacade.addOneAnetExChu(antExcAddRequest, Integer.valueOf(assistUserId));
524   - System.out.println("auto generate antexc end," + baseResponse.toString());
  527 + BaseResponse baseResponse = antenatalExaminationFacade.addOneAnetExChu(antExcAddRequest, Integer.valueOf(assistUserId));
  528 + System.out.println("auto generate antexc end," + baseResponse.toString());
  529 + }
  530 + }catch (Exception e){
  531 + e.printStackTrace();
525 532 }
526   - }catch (Exception e){
527   - e.printStackTrace();
528 533 }
529   - }
530   - }).start();
  534 + }).start();
531 535  
532   - System.out.println("confirmArchive return :"+JsonUtil.obj2JsonString(baseObjectResponse));
533   - if(baseObjectResponse.getErrorcode()==ErrorCodeConstants.SUCCESS){
534 536 writeString(response,"success");
535 537 return;
536 538 }