Commit 08c91a3cd73037d716e9c305948877f2c0ad3851

Authored by jiangjiazhi

Merge remote-tracking branch 'origin/master'

Showing 2 changed files

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/JdbcUtil.java View file @ 08c91a3
... ... @@ -43,10 +43,12 @@
43 43 private static Map<String, String> datacontents = new HashMap<>();
44 44 private static Map<String, String> basicConfigs = new HashMap<>();
45 45  
  46 + private static Integer orgId = 0;
46 47  
  48 +
47 49 private static BlockingQueue<SimplePatient> bq = new LinkedBlockingQueue();
48 50  
49   - private static ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(15, 20, 1, TimeUnit.HOURS, new LinkedBlockingQueue<Runnable>());
  51 + private static ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(10, 15, 1, TimeUnit.HOURS, new LinkedBlockingQueue<Runnable>());
50 52  
51 53 private static class Chanle extends Thread {
52 54 private MongoTemplate mongoTemplate;
... ... @@ -114,7 +116,8 @@
114 116 }
115 117 }
116 118  
117   - public static void initData() {
  119 + public static void initData(Integer mysqlHid) {
  120 + orgId = mysqlHid;
118 121 List<Map<String, Object>> listEmp = getListDataBySql("select e.e_name,e.e_id from mommy_employee e");
119 122 for (Map<String, Object> map : listEmp) {
120 123 employees.put(getString(map.get("E_ID")), getString(map.get("E_NAME")));
... ... @@ -137,7 +140,7 @@
137 140  
138 141 System.out.println("oracleHosps------" + oracleHosps.size());
139 142  
140   - List<Map<String, Object>> usersList = getMysqlListDataBySql("select id,name from users where org_id = 216 ");
  143 + List<Map<String, Object>> usersList = getMysqlListDataBySql("select id,name from users where org_id = "+mysqlHid);
141 144 for (Map<String, Object> map : usersList) {
142 145 System.out.println(map);
143 146 users.put(getString(map.get("name")), getString(map.get("id")));
... ... @@ -176,7 +179,7 @@
176 179  
177 180  
178 181 public static String getOrgIdByName(String name) {
179   - return "216";
  182 + return String.valueOf(orgId);
180 183 }
181 184  
182 185 public static String getEmpNameById(String id) {
... ... @@ -986,7 +989,7 @@
986 989 " INNER JOIN PLAT_DATACONTENT K ON J.ME_WORNINGID = K.DC_ID AND K.DC_ISVALID=1 AND K.DC_DATATYPEID='fb43fd5a-b153-4cb9-9180-c46f5612ba43' AND K.DC_NAME<>'其他' \n" +
987 990 " --高危等级\n" +
988 991 " INNER JOIN PLAT_DATACONTENT L ON K.DC_PARENTID=L.DC_ID AND L.DC_ISVALID=1\n" +
989   - " INNER JOIN LYMS_BASICCONFIG LL ON K.DC_NAME=LL.NAME\n" +
  992 + " INNER JOIN LYMS_BASICCONFIG LL ON K.DC_NAME=LL.NAME AND LL.PARENTID IN ('49a36aea-c5b6-4162-87d2-9eb3c6ec00c2','eb146c03-b19f-4e28-b85f-fda574b2283b','315107bd-91fe-42a1-9237-752f3c046a40','e637b361-99cf-41eb-84f2-f0dab596e928','224b2329-cb82-4da3-a071-8527f8283aab') \n" +
990 993 " -- UNION ALL \n" +
991 994 " --其他高危评分\n" +
992 995 " --SELECT M.ID,M.MO_CONTENT,M.MO_COLORNAME,M.MO_VALUES FROM MOMMY_OTHERWORNING M\n" +
993 996  
... ... @@ -1119,12 +1122,12 @@
1119 1122 while (true) {
1120 1123 List<Map<String, Object>> list = getListDataBySql(" SELECT * FROM ( SELECT A.*, ROWNUM RN FROM " +
1121 1124 " (select replace(m.PI_ID,'-','') as ID,m.* from MOMMY_PATIENTINFO m where m.pi_bookbuildinghospitalid='" + hospitalId + "') " +
1122   - " A WHERE ROWNUM < " + (num + 20) + " ) WHERE RN >= " + num + " ");
  1125 + " A WHERE ROWNUM < " + (num + 50) + " ) WHERE RN >= " + num + " ");
1123 1126 if (list == null || list.size() == 0) {
1124 1127 break;
1125 1128 }
1126 1129  
1127   - num = num + 20;
  1130 + num = num + 50;
1128 1131 for (Map<String, Object> map : list) {
1129 1132 try {
1130 1133 PersonModel personModel = new PersonModel();
... ... @@ -1202,8 +1205,10 @@
1202 1205  
1203 1206  
1204 1207 if (buildHospitalId != null && !"".equals(buildHospitalId)) {
1205   - String hname = getString(getOralceSingleObjBySql("select h_name from plat_hospital h where h.h_isvalid=1 and h_id = '" + buildHospitalId + "'"));
1206   - String id = getString(getMysqlSingleObjBySql("select id from organization where name = '" + hname + "'"));
  1208 + String hname = getPatHosptalById(buildHospitalId);
  1209 +// String hname = getString(getOralceSingleObjBySql("select h_name from plat_hospital h where h.h_isvalid=1 and h_id = '" + buildHospitalId + "'"));
  1210 +// String id = getString(getMysqlSingleObjBySql("select id from organization where name = '" + hname + "'"));
  1211 + String id = getOrgIdByName(hname);
1207 1212 model.setHospitalId(id);
1208 1213 }
1209 1214  
... ... @@ -1215,7 +1220,8 @@
1215 1220  
1216 1221 String dueTypeId = getString(map.get("PI_FENMIAN"));
1217 1222 if (dueTypeId != null && !"".equals(dueTypeId)) {
1218   - String name = getString(getOralceSingleObjBySql("select pd.dc_name from Plat_Datacontent pd where pd.dc_id='" + dueTypeId + "'"));
  1223 + String name = getDataContentByById(dueTypeId);
  1224 + //String name = getString(getOralceSingleObjBySql("select pd.dc_name from Plat_Datacontent pd where pd.dc_id='" + dueTypeId + "'"));
1219 1225 model.setDueType(FmTypeEnums.getIdByName(name));
1220 1226 }
1221 1227  
... ... @@ -1228,8 +1234,10 @@
1228 1234  
1229 1235 String doctorId = getString(map.get("PI_CREATEOPER"));
1230 1236 if (doctorId != null && !"".equals(doctorId)) {
1231   - String hname = getString(getOralceSingleObjBySql("select e.e_name from mommy_employee e where e.e_id = '" + doctorId + "'"));
1232   - String id = getString(getMysqlSingleObjBySql("select id from users where name = '" + hname + "'"));
  1237 + String hname = getEmpNameById(doctorId);
  1238 + //String hname = getString(getOralceSingleObjBySql("select e.e_name from mommy_employee e where e.e_id = '" + doctorId + "'"));
  1239 + //String id = getString(getMysqlSingleObjBySql("select id from users where name = '" + hname + "'"));
  1240 + String id = getUserIdByName(hname);
1233 1241 model.setBuildDoctor(id);
1234 1242 }
1235 1243  
... ... @@ -1321,7 +1329,8 @@
1321 1329  
1322 1330 String hname = getString(map.get("CER_EXAMINHOSPITAL"));
1323 1331 if (hname != null && !"".equals(hname)) {
1324   - String id = getString(getMysqlSingleObjBySql("select id from organization where name = '" + hname + "'"));
  1332 + String id = getOrgIdByName(hname);
  1333 + //String id = getString(getMysqlSingleObjBySql("select id from organization where name = '" + hname + "'"));
1325 1334 checkModel.setHospitalId(id);
1326 1335 }
1327 1336 checkModel.setCreated(getDate(map.get("CER_CREATETIME")));
... ... @@ -1331,7 +1340,8 @@
1331 1340  
1332 1341 String doctorName = getString(map.get("CER_DOCTORSIGNATURE"));
1333 1342 if (doctorName != null && !"".equals(doctorName)) {
1334   - String id = getString(getMysqlSingleObjBySql("select id from users where name = '" + doctorName + "'"));
  1343 + String id = getUserIdByName(doctorName);
  1344 + // String id = getString(getMysqlSingleObjBySql("select id from users where name = '" + doctorName + "'"));
1335 1345 checkModel.setCheckDoctor(id);
1336 1346 }
1337 1347  
... ... @@ -1525,7 +1535,7 @@
1525 1535 }
1526 1536 }
1527 1537  
1528   - public void syncDataBaby(String hid, MongoTemplate mongoTemplate) {
  1538 + public static void syncDataBaby(String hid, MongoTemplate mongoTemplate) {
1529 1539 try {
1530 1540 syncBabyData(hid, mongoTemplate);
1531 1541 } catch (Exception e) {
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java View file @ 08c91a3
... ... @@ -97,24 +97,25 @@
97 97  
98 98 @RequestMapping(value = "/syncData", method = RequestMethod.GET)
99 99 @ResponseBody
100   - public String syncData(@RequestParam(required = true) final String hid) {
  100 + public String syncData(@RequestParam(required = true) final String oracleHid,@RequestParam(required = true) final Integer mysqlHid) {
101 101 final MongoTemplate template = mongoTemplate;
102   -// new Thread(new Runnable() {
103   -// @Override
104   -// public void run() {
105   -// System.out.print("同步开始儿童>>>>>>>>>>>>>>>>>>>>>>>>>");
106   -// new com.lyms.platform.biz.JdbcUtil().syncDataBaby(hid, template);
107   -// System.out.print("同步结束儿童>>>>>>>>>>>>>>>>>>>>>>>>>");
108   -// }
109   -// }).start();
110   - JdbcUtil.initData();
  102 +
  103 + JdbcUtil.initData(mysqlHid);
111 104 System.out.println("initData------");
112 105  
113   - System.out.println("同步开始孕妇1>>>>>>>>>>>>>>>>>>>>>>>>>");
114   - JdbcUtil.syncDataPat(hid, template);
115   - System.out.println("同步结束孕妇1>>>>>>>>>>>>>>>>>>>>>>>>>");
  106 + new Thread(new Runnable() {
  107 + @Override
  108 + public void run() {
  109 + System.out.print("同步开始儿童>>>>>>>>>>>>>>>>>>>>>>>>>");
  110 + JdbcUtil.syncDataBaby(oracleHid, template);
  111 + System.out.print("同步结束儿童>>>>>>>>>>>>>>>>>>>>>>>>>");
  112 + }
  113 + }).start();
116 114  
117 115  
  116 +// System.out.println("同步开始孕妇1>>>>>>>>>>>>>>>>>>>>>>>>>");
  117 +// JdbcUtil.syncDataPat(oracleHid, template);
  118 +// System.out.println("同步结束孕妇1>>>>>>>>>>>>>>>>>>>>>>>>>");
118 119 return "starting...........";
119 120 }
120 121 }