Commit d58b3543699fc630ca6473e88e5cd080cfc9ee96

Authored by yangfei

Merge remote-tracking branch 'origin/master'

Showing 8 changed files

platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/LisServiceImpl.java View file @ d58b354
... ... @@ -13,6 +13,8 @@
13 13 import org.apache.commons.collections.CollectionUtils;
14 14 import org.codehaus.jackson.type.TypeReference;
15 15 import org.springframework.beans.factory.annotation.Autowired;
  16 +import org.springframework.beans.factory.annotation.Qualifier;
  17 +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
16 18 import org.springframework.stereotype.Service;
17 19  
18 20 import java.util.ArrayList;
... ... @@ -25,6 +27,11 @@
25 27 public class LisServiceImpl implements LisService {
26 28  
27 29 @Autowired
  30 + @Qualifier("commonThreadPool")
  31 + private ThreadPoolTaskExecutor commonThreadPool;
  32 +
  33 +
  34 + @Autowired
28 35 private MasterLisMapper masterLisMapper;
29 36  
30 37 @Override
... ... @@ -45,7 +52,8 @@
45 52 end = lisList.size();
46 53 }
47 54 List<LisReportModel> models = lisList.subList(i, end);
48   - new Thread(new LisSaveTask(countDownLatch,masterLisMapper,models)).start();
  55 +// new Thread(new LisSaveTask(countDownLatch,masterLisMapper,models)).start();
  56 + commonThreadPool.execute(new LisSaveTask(countDownLatch,masterLisMapper,models));
49 57 }
50 58 countDownLatch.await();
51 59 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/LisController.java View file @ d58b354
... ... @@ -33,9 +33,6 @@
33 33 @Controller
34 34 public class LisController extends BaseController {
35 35  
36   - //日志调测器
37   - private static final Logger logger = LoggerFactory.getLogger("lis-sync-log");
38   -
39 36 @Autowired
40 37 private LisService lisService;
41 38 @Autowired
... ... @@ -53,8 +50,6 @@
53 50 @ResponseBody
54 51 public BaseResponse saveLisData(@RequestBody List<LisReportModelRequest> models,
55 52 HttpServletRequest httpServletRequest) {
56   -
57   -
58 53 List<LisReportModel> list = new ArrayList<>();
59 54 System.out.println("resivce size = " + models.size());
60 55 if (models != null && models.size() > 0)
61 56  
62 57  
... ... @@ -91,13 +86,12 @@
91 86 model.setCheckTime(DateUtil.parseYMDHMS(lisRequest.getCheckTime()));
92 87  
93 88 list.add(model);
94   - }catch (Exception e)
  89 + }
  90 + catch (Exception e)
95 91 {
96   - logger.error("lis id == "+lisRequest.getLisId());
  92 + ExceptionUtils.catchException(e,"lis id == "+lisRequest.getLisId());
97 93 continue;
98 94 }
99   -
100   -
101 95 }
102 96 }
103 97 return lisService.saveLisData(list);
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/SyncDataController.java View file @ d58b354
... ... @@ -108,7 +108,7 @@
108 108 writeString(response, "execSyncMysqlData fail");
109 109 ExceptionUtils.catchException(e,"execSyncMysqlData fail");
110 110 }
111   - writeString(response,"execSyncMysqlData success");
  111 + writeString(response,"success");
112 112 }
113 113  
114 114 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java View file @ d58b354
... ... @@ -858,6 +858,8 @@
858 858 List<String> hList = groupsFacade.findGroupHospital(userId, false);
859 859 babyQuery.setHospitalIdList(hList);
860 860  
  861 + Map<String,List<BabyChooseResult>> listMap = new HashMap<>();
  862 +
861 863 List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyQuery);
862 864  
863 865 if (CollectionUtils.isEmpty(models) && StringUtils.isNotEmpty(vcCardNo))
... ... @@ -879,6 +881,9 @@
879 881  
880 882 if (CollectionUtils.isNotEmpty(models))
881 883 {
  884 +
  885 +
  886 +
882 887 for (BabyModel model : models) {
883 888 if (model != null && model.getHospitalId() != null && hList.contains(hospitalId)) {
884 889 isBuild = true;
885 890  
886 891  
... ... @@ -890,11 +895,61 @@
890 895 result.setGender(SexEnum.getTextById(model.getSex()));
891 896 result.setName(model.getName());
892 897 result.setBirth(DateUtil.getyyyy_MM_dd(model.getBirth()));
893   - results.add(result);
  898 + result.setHospitalId(model.getHospitalId());
  899 + String hospital = "";
  900 + if (org.apache.commons.lang.StringUtils.isNotEmpty(model.getHospitalId())) {
  901 + Organization organization = organizationService.getOrganization(Integer.parseInt(model.getHospitalId()));
  902 + if (organization != null && organization.getYn() == YnEnums.YES.getId()) {
  903 + hospital = organization.getName();
  904 + }
  905 + }
  906 + result.setHospitalName(hospital);
  907 +
  908 + List<BabyChooseResult> list = new ArrayList<>();
  909 + if (listMap.get(model.getPid()) != null)
  910 + {
  911 + list = listMap.get(model.getPid());
  912 + list.add(result);
  913 + }
  914 + else
  915 + {
  916 + list.add(result);
  917 + }
  918 + listMap.put(model.getPid(),list);
  919 +
  920 +// results.add(result);
894 921 }
895 922 }
896 923  
  924 +
  925 + if (listMap != null)
  926 + {
  927 + for (String pid : listMap.keySet())
  928 + {
  929 + List<BabyChooseResult> currentBuildRecord = new ArrayList<>();
  930 +
  931 + List<BabyChooseResult> list = listMap.get(pid);
  932 + for(BabyChooseResult baby : list)
  933 + {
  934 + if (StringUtils.isNotEmpty(hospitalId) && hospitalId.equals(baby.getHospitalId()))
  935 + {
  936 + currentBuildRecord.add(baby);
  937 + break;
  938 + }
  939 + }
  940 + if (CollectionUtils.isNotEmpty(currentBuildRecord))
  941 + {
  942 + results.addAll(currentBuildRecord);
  943 + }
  944 + else
  945 + {
  946 + results.addAll(list);
  947 + }
  948 + }
  949 +
  950 + }
897 951 }
  952 +
898 953 map.put("isBuild", isBuild);
899 954 map.put("boies", results);
900 955 br.setData(map);
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java View file @ d58b354
... ... @@ -2576,7 +2576,7 @@
2576 2576 PostReviewModel postReviewModel = postReviewService.findOneById(id);
2577 2577  
2578 2578 Patients patients = patientsService.findOnePatientById(postReviewModel.getParentId());
2579   - if (patients == null) {
  2579 + if (patients != null) {
2580 2580 /* 基础信息 */
2581 2581 map.put("id", id);
2582 2582 map.put("username", patients.getUsername());
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/BabyChooseResult.java View file @ d58b354
... ... @@ -10,6 +10,24 @@
10 10 private String gender;
11 11 private String monthAge;
12 12 private String pid;
  13 + private String hospitalId;
  14 + private String hospitalName;
  15 +
  16 + public String getHospitalName() {
  17 + return hospitalName;
  18 + }
  19 +
  20 + public void setHospitalName(String hospitalName) {
  21 + this.hospitalName = hospitalName;
  22 + }
  23 +
  24 + public String getHospitalId() {
  25 + return hospitalId;
  26 + }
  27 +
  28 + public void setHospitalId(String hospitalId) {
  29 + this.hospitalId = hospitalId;
  30 + }
13 31  
14 32 public String getPid() {
15 33 return pid;
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/HttpClientUtil.java View file @ d58b354
... ... @@ -151,6 +151,7 @@
151 151 } catch (Exception e) {
152 152 ExceptionUtils.catchException(e,"error https post ");
153 153 e.printStackTrace();
  154 + return null;
154 155 } finally {
155 156 if (response != null) {
156 157 try {
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/SendMysqlSyncDatUtil.java View file @ d58b354
... ... @@ -23,6 +23,8 @@
23 23 @Component
24 24 public class SendMysqlSyncDatUtil implements InitializingBean {
25 25  
  26 + public static final String run_mode = PropertiesUtils.getPropertyValue("run.mode");
  27 +
26 28 private static BlockingQueue<SqlRequest> syncSqlQueue = new LinkedBlockingQueue(500);
27 29  
28 30 //配置文件中配置的要同步的区域的url地址
29 31  
... ... @@ -56,14 +58,18 @@
56 58  
57 59 /**
58 60 * 初始化启动发送sql的线程
  61 + * 线上才启动
59 62 * @throws Exception
60 63 */
61 64 @Override
62 65 public void afterPropertiesSet() throws Exception {
63   - System.out.println("init .........");
64   - Thread thread = new HandleThread();
65   - thread.setName("syncMysqlThread");
66   - thread.start();
  66 + if ("2".equals(run_mode))
  67 + {
  68 + System.out.println("init .........");
  69 + Thread thread = new HandleThread();
  70 + thread.setName("syncMysqlThread");
  71 + thread.start();
  72 + }
67 73 }
68 74  
69 75  
... ... @@ -85,8 +91,16 @@
85 91 {
86 92 for(String url : urls)
87 93 {
88   - String result = HttpClientUtil.doPostSSL(url,json,"3d19960bf3e81e7d816c4f26051c49ba");
89   - System.out.println("sync mysql result = " + result);
  94 + for (int i = 0 ; i < 3 ; i++)
  95 + {
  96 + String result = HttpClientUtil.doPostSSL(url,json,"3d19960bf3e81e7d816c4f26051c49ba");
  97 + System.out.println("sync mysql result = " + result+";url="+url);
  98 + if (result == null)
  99 + {
  100 + continue;
  101 + }
  102 + break;
  103 + }
90 104 }
91 105 }
92 106 } catch (Exception e) {