Commit 3983d588fdf5a4c07a278f19c1cd6f7f75db5572

Authored by gengxiaokai
1 parent f65e935916

诸城初诊,复诊接口

Showing 1 changed file with 86 additions and 54 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/SieveFacade.java View file @ 3983d58
... ... @@ -21,16 +21,16 @@
21 21 import com.lyms.platform.operate.web.service.ITrackDownService;
22 22 import com.lyms.platform.operate.web.worker.SieveWorker;
23 23 import com.lyms.platform.permission.model.Organization;
  24 +import com.lyms.platform.permission.model.Users;
24 25 import com.lyms.platform.permission.service.OrganizationService;
  26 +import com.lyms.platform.permission.service.UsersService;
25 27 import com.lyms.platform.pojo.*;
26 28 import com.lyms.platform.query.*;
27   -/*import javafx.beans.binding.ObjectExpression;*/
28 29 import org.apache.commons.collections.CollectionUtils;
29 30 import org.apache.commons.lang.StringUtils;
30 31 import org.apache.commons.lang.math.NumberUtils;
31 32 import org.springframework.beans.factory.annotation.Autowired;
32 33 import org.springframework.beans.factory.annotation.Qualifier;
33   -import org.springframework.data.domain.Sort;
34 34 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
35 35 import org.springframework.stereotype.Component;
36 36  
... ... @@ -61,6 +61,9 @@
61 61 private PatientsService patientsService;
62 62  
63 63 @Autowired
  64 + private UsersService usersService;
  65 +
  66 + @Autowired
64 67 private OrganizationGroupsFacade groupsFacade;
65 68  
66 69 @Autowired
... ... @@ -243,7 +246,7 @@
243 246 }
244 247  
245 248  
246   - public String getSieveStatus(String patientId,String hospitalId)
  249 + public String getSieveStatus(String patientId,String hospitalId)
247 250 {
248 251  
249 252 String siveStatus = "";
250 253  
... ... @@ -394,12 +397,9 @@
394 397 sieveQuery.setNeed(needPage);
395 398 String hospitalId = autoMatchFacade.getHospitalId(userId);
396 399 sieveQuery.setHospitalId(hospitalId);
397   - // System.out.println("产筛列表:"+sieveQuery.convertToQuery().convertToMongoQuery());
398 400 //查询产筛list
399 401 List<SieveModel> list = sieveService.queryList1(sieveQuery, "order");
400 402 List<SieveListResult> data = new ArrayList<>();
401   -
402   -
403 403 int batchSize = 4;
404 404 int end = 0;
405 405 List<Future> listFuture = new ArrayList<>();
... ... @@ -408,7 +408,7 @@
408 408 if (end > list.size()) {
409 409 end = list.size();
410 410 }
411   - listFuture.add(commonThreadPool.submit(new SieveWorker(hospitalId, list.subList(i, end), antenatalExaminationService, patientsService,applyOrderService)));
  411 + listFuture.add(commonThreadPool.submit(new SieveWorker(hospitalId, list.subList(i, end), antenatalExaminationService, patientsService,applyOrderService,organizationService)));
412 412 }
413 413 for (Future f : listFuture) {
414 414 try {
... ... @@ -417,49 +417,6 @@
417 417 ExceptionUtils.catchException(e, "cqSieve list get result Future error.");
418 418 }
419 419 }
420   -
421   -
422   -
423   -/*
424   - if (CollectionUtils.isNotEmpty(list)) {
425   - for (SieveModel sieveModel : list) {
426   - SieveListResult sieveListResult = new SieveListResult();
427   - AntExQuery antExQuery = new AntExQuery();
428   - antExQuery.setYn(YnEnums.YES.getId());
429   - antExQuery.setHospitalId(hospitalId);
430   - antExQuery.setParentId(sieveModel.getParentId());
431   - List<AntenatalExaminationModel> list1 = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "created"));
432   - if (CollectionUtils.isNotEmpty(list1)) {
433   - if (StringUtils.isNotEmpty(list1.get(0).getTireNumber())) {
434   - sieveModel.setTireNumber(NumberUtils.toInt(list1.get(0).getTireNumber()));
435   - }
436   - } else {
437   - AntExChuQuery antExChuQuery = new AntExChuQuery();
438   - antExChuQuery.setYn(YnEnums.YES.getId());
439   - antExChuQuery.setParentId(sieveModel.getParentId());
440   - antExChuQuery.setHospitalId(hospitalId);
441   - List<AntExChuModel> antExChuModels = antenatalExaminationService.queryAntExChu(antExChuQuery);
442   - if (CollectionUtils.isNotEmpty(antExChuModels)) {
443   - if (StringUtils.isNotEmpty(antExChuModels.get(0).getTireNumber())) {
444   - sieveModel.setTireNumber(NumberUtils.toInt(antExChuModels.get(0).getTireNumber()));
445   - }
446   - }
447   - }
448   -
449   - sieveListResult.convertToResult(sieveModel);
450   - Patients patients = patientsService.findOnePatientById(sieveModel.getParentId());
451   - if (null != patients) {
452   - sieveListResult.setIsGravida((patients.getType() == 3 && patients.getFmDate() != null) ? "0" : "1");
453   - if (null != patients.getDueStatus() && 1 == patients.getDueStatus())
454   - sieveListResult.setcDueWeek("终止妊娠");
455   - else if (patients.getType() == 3) {
456   - sieveListResult.setcDueWeek("已分娩");
457   - }
458   - sieveListResult.setAge(DateUtil.getAge(patients.getBirth()) + "岁");
459   - }
460   - data.add(sieveListResult);
461   - }
462   - }*/
463 420 return new BaseListResponse().setData(data).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setPageInfo(sieveQuery.getPageInfo());
464 421 }
465 422  
... ... @@ -598,7 +555,7 @@
598 555 Patients pat = null;
599 556 if (CollectionUtils.isNotEmpty(localPatients))
600 557 {
601   - pat = localPatients.get(0);
  558 + pat = localPatients.get(0);
602 559 }
603 560 else
604 561 {
... ... @@ -641,7 +598,7 @@
641 598 return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(patientBaseResult);
642 599 }
643 600  
644   - public BaseResponse getSieveApplyInfo(String parentId, Integer userId) {
  601 + public BaseResponse getSieveApplyInfo(String parentId, Integer userId,Integer type) {
645 602  
646 603 Map<String,Object> map = new HashMap<>();
647 604 String hospitalId = autoMatchFacade.getHospitalId(userId);
... ... @@ -684,7 +641,7 @@
684 641 patientBaseResult.setRiskFactor(highScoreResult.getHighRisk());
685 642 patientBaseResult.setRiskScore(highScoreResult.getScoreStr());
686 643  
687   - map.put("patientInfo",patientBaseResult);
  644 + map.put("patientInfo", patientBaseResult);
688 645  
689 646 SieveApplyOrderQuery sieveApplyOrderQuery1 = new SieveApplyOrderQuery();
690 647 sieveApplyOrderQuery1.setParentId(parentId);
691 648  
... ... @@ -697,12 +654,14 @@
697 654 if (CollectionUtils.isNotEmpty(sieveApplyOrderModels))
698 655 {
699 656 Map<String,Object> result = new HashMap<>();
  657 +
  658 + Map<String,Object> viewInfo = new HashMap<>();
700 659 SieveApplyOrderModel sieveApply = sieveApplyOrderModels.get(0);
701 660  
702 661 result.put("id",sieveApply.getId());
703 662 result.put("parentId",sieveApply.getParentId());
704 663  
705   - result.put("checkItem",sieveApply.getCheckItem());
  664 + result.put("check",sieveApply.getCheckItem());
706 665 result.put("guide",sieveApply.getGuide());
707 666 result.put("checkDate",sieveApply.getCheckDate());
708 667 result.put("applyDoctor",sieveApply.getApplyDoctor());
709 668  
710 669  
711 670  
... ... @@ -715,17 +674,90 @@
715 674 result.put("collectionDoctorId",sieveApply.getCollectionDoctorId());
716 675 result.put("collectionDate",DateUtil.getyyyy_MM_dd(sieveApply.getCollectionDate()));
717 676 result.put("crl",sieveApply.getCrl());
  677 + result.put("bpd",sieveApply.getBpd());
718 678 result.put("bcCheckDate",DateUtil.getyyyy_MM_dd(sieveApply.getBcCheckDate()));
719 679 result.put("historyBirth",sieveApply.getHistoryBirth());
720 680 result.put("pastHistory",sieveApply.getPastHistory());
721 681 result.put("applyHospitalId",sieveApply.getApplyHospitalId());
722 682 result.put("sendDoctor",sieveApply.getSendDoctor());
723 683 result.put("sendTime",DateUtil.getyyyy_MM_dd(sieveApply.getSendTime()));
  684 + result.put("age",DateUtil.getAge(sieveApply.getBirth(), sieveApply.getCreated()));
  685 + result.put("mensesDay",sieveApply.getMensesDay());
  686 + result.put("mensesWeek",sieveApply.getMensesWeek());
  687 + result.put("experimentNum","");
724 688  
725 689 map.put("sieveApplyInfo",result);
726 690  
  691 + if (type == 1)
  692 + {
  693 + if (com.lyms.platform.common.utils.StringUtils.isNum(sieveApply.getApplyDoctor())) {
  694 + Users users = usersService.getUsers(Integer.parseInt(sieveApply.getApplyDoctor()));
  695 + if (users != null && users.getYn() == YnEnums.YES.getId()) {
  696 + viewInfo.put("applyDoctorName",users.getName());
  697 + }
  698 + }
  699 +
  700 + if (com.lyms.platform.common.utils.StringUtils.isNum(sieveApply.getCollectionDoctorId())) {
  701 + Users users = usersService.getUsers(Integer.parseInt(sieveApply.getCollectionDoctorId()));
  702 + if (users != null && users.getYn() == YnEnums.YES.getId()) {
  703 + viewInfo.put("collectionDoctorName",users.getName());
  704 + }
  705 + }
  706 +
  707 + if (com.lyms.platform.common.utils.StringUtils.isNum(sieveApply.getSendDoctor())) {
  708 + Users users = usersService.getUsers(Integer.parseInt(sieveApply.getSendDoctor()));
  709 + if (users != null && users.getYn() == YnEnums.YES.getId()) {
  710 + viewInfo.put("sendDoctorName",users.getName());
  711 + }
  712 + }
  713 + if (null != sieveApply.getApplyHospitalId()) {
  714 + Organization org = organizationService.getOrganization(Integer.valueOf(sieveApply.getApplyHospitalId()));
  715 + if (null != org) {
  716 + viewInfo.put("applyHospitalName", org.getName());
  717 + }
  718 + }
  719 + String isTire = "";
  720 + String tireNumber = "";
  721 +
  722 + AntExChuQuery antExChuQuery1 = new AntExChuQuery();
  723 + antExChuQuery1.setParentId(parentId);
  724 + antExChuQuery1.setYn(YnEnums.YES.getId());
  725 + List<AntExChuModel> data1 = antenatalExaminationService.queryAntExChu(antExChuQuery1);
  726 + if (CollectionUtils.isNotEmpty(data1))
  727 + {
  728 + AntExChuModel chuModel = data1.get(0);
  729 + if (StringUtils.isNotEmpty(chuModel.getTireNumber()))
  730 + {
  731 + isTire = Integer.parseInt(chuModel.getTireNumber()) > 1 ? "是":"否";
  732 + tireNumber = chuModel.getTireNumber();
  733 + }
  734 + }
  735 +
  736 + map.put("isTire",isTire);
  737 + map.put("tireNumber",tireNumber);
  738 +
  739 + map.put("viewInfo",viewInfo);
  740 + }
  741 + else if (type == 3)
  742 + {
  743 + Map<String,Object> sieveInfo = new HashMap<>();
  744 +
  745 +
  746 + map.put("sieveInfo",sieveInfo);
  747 + }
  748 +
727 749 }
728 750 return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(map);
  751 + }
  752 +
  753 + public BaseResponse reviceSieve(String parentId, Integer userId) {
  754 + String hospitalId = autoMatchFacade.getHospitalId(userId);
  755 + SieveModel sieve = new SieveModel();
  756 + sieve.setParentId(parentId);
  757 + sieve.setHospitalId(hospitalId);
  758 + sieve.setReviceStatus(2);
  759 + sieveService.updateOneChanQianDiaSieve(sieve);
  760 + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
729 761 }
730 762 }