Commit ef0891f58626e084d93ba8f28e7c90eeb1e38121
1 parent
99dad1153e
Exists in
master
and in
6 other branches
update code
Showing 9 changed files with 86 additions and 31 deletions
- platform-common/src/main/java/com/lyms/platform/common/enums/WxTempleteIdEnums.java
- platform-msg-generate/src/main/java/com/lyms/platform/msg/worker/TempleteMsgGenerateWorker.java
- platform-sync-data/src/main/java/com/lyms/platform/sync/data/service/SyncDataService.java
- platform-sync-data/src/main/java/com/lyms/platform/sync/data/util/JDBCUtil.java
- platform-sync-data/src/main/java/com/lyms/platform/sync/data/web/controller/SyncDataController.java
- platform-sync-data/src/main/resources/config.properties
- platform-sync-data/src/main/resources/database.properties
- platform-sync-data/src/main/resources/spring/applicationContext-mvc.xml
- platform-sync-data/src/main/resources/spring/spring-mongodb.xml
platform-common/src/main/java/com/lyms/platform/common/enums/WxTempleteIdEnums.java
View file @
ef0891f
| ... | ... | @@ -20,7 +20,8 @@ |
| 20 | 20 | GAO_WEI_ZHI_DAO("n6fSC1wYc3jOfGmuI1Vtbut6TlaBPlt5482SqJ8CE4o","高危提醒"), |
| 21 | 21 | |
| 22 | 22 | ER_JIAN_KANG_ZHI_DAO("dqvyESU8UXx1V3cIMQDqj4PLxI6T9-sgihQcs3ZGL9E","儿童健康指导"), |
| 23 | - CHAN_JIAN_KANG_ZHI_DAO("jEbeeBKyjcquhFWUUndnRddLqLbK8-QF6yA98cYW_E8","产妇健康指导"); | |
| 23 | + CHAN_JIAN_KANG_ZHI_DAO("H2_ucLqVEbsZAv-EZcmUDpD1Zul5NGqMoJktHT0u4gw","产妇健康指导"), | |
| 24 | + CHAN_HOU_FU_CHA("jEbeeBKyjcquhFWUUndnRddLqLbK8-QF6yA98cYW_E8","产后复查");//产后预约和产后复查 | |
| 24 | 25 | private WxTempleteIdEnums(String id, String name){ |
| 25 | 26 | this.name=name; |
| 26 | 27 | this.id =id; |
platform-msg-generate/src/main/java/com/lyms/platform/msg/worker/TempleteMsgGenerateWorker.java
View file @
ef0891f
| ... | ... | @@ -611,7 +611,7 @@ |
| 611 | 611 | messageContent = HelperUtils.replaceEL(pat.getUsername(), actualSendDate, messageContent); |
| 612 | 612 | MessageRequest request = HelperUtils.getMessageRequest(messageContent, pat.getPhone(), |
| 613 | 613 | ServiceObjEnums.CHANOBJ.getId(), template.getSmsType(), |
| 614 | - pat.getHospitalId(), template.getId(), pat.getId(), title, DateUtils.getDateStr(actualSendDate,DateUtils.Y_M_D), "", WxTempleteIdEnums.CHAN_JIAN_TI_XING.getId()); | |
| 614 | + pat.getHospitalId(), template.getId(), pat.getId(), title, DateUtils.getDateStr(actualSendDate,DateUtils.Y_M_D), "", WxTempleteIdEnums.CHAN_HOU_FU_CHA.getId()); | |
| 615 | 615 | |
| 616 | 616 | messages.add(request); |
| 617 | 617 | } |
| ... | ... | @@ -672,7 +672,7 @@ |
| 672 | 672 | String title = "产后复查"; |
| 673 | 673 | MessageRequest request = HelperUtils.getMessageRequest(messageContent, pat.getPhone(), |
| 674 | 674 | ServiceObjEnums.CHANOBJ.getId(), template.getSmsType(), |
| 675 | - pat.getHospitalId(), template.getId(), pat.getId(), title, days, "", WxTempleteIdEnums.CHAN_JIAN_TI_XING.getId()); | |
| 675 | + pat.getHospitalId(), template.getId(), pat.getId(), title, days, "", WxTempleteIdEnums.CHAN_HOU_FU_CHA.getId()); | |
| 676 | 676 | messages.add(request); |
| 677 | 677 | } |
| 678 | 678 | } |
platform-sync-data/src/main/java/com/lyms/platform/sync/data/service/SyncDataService.java
View file @
ef0891f
| ... | ... | @@ -43,9 +43,29 @@ |
| 43 | 43 | private MongoTemplate mongoTemplate; |
| 44 | 44 | |
| 45 | 45 | |
| 46 | - private static ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(5, 10, 1, TimeUnit.HOURS, new LinkedBlockingQueue<Runnable>()); | |
| 46 | + private static ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 2, 1, TimeUnit.HOURS, new LinkedBlockingQueue<Runnable>()); | |
| 47 | 47 | |
| 48 | + public void deleteData(String hospitalId,String personId) { | |
| 49 | + Query query = new MongoQuery(new MongoCondition("hospitalId", hospitalId, MongoOper.IS)).convertToMongoQuery(); | |
| 48 | 50 | |
| 51 | + List<Patients> list = mongoTemplate.find(query, Patients.class); | |
| 52 | + System.out.println("delete size = "+list.size()); | |
| 53 | + int count = 0; | |
| 54 | + if(CollectionUtils.isNotEmpty(list)) | |
| 55 | + { | |
| 56 | + for(Patients pat : list) | |
| 57 | + { | |
| 58 | + | |
| 59 | + String pid = pat.getPid(); | |
| 60 | + query = new MongoQuery(new MongoCondition("id", pid, MongoOper.IS)).convertToMongoQuery(); | |
| 61 | + count++; | |
| 62 | + mongoTemplate.findAllAndRemove(query, PersonModel.class); | |
| 63 | + } | |
| 64 | + } | |
| 65 | + System.out.println("==========="+count); | |
| 66 | + } | |
| 67 | + | |
| 68 | + | |
| 49 | 69 | private class Chanle extends Thread { |
| 50 | 70 | private MongoTemplate mongoTemplate; |
| 51 | 71 | |
| ... | ... | @@ -90,7 +110,7 @@ |
| 90 | 110 | @Override |
| 91 | 111 | public void run() { |
| 92 | 112 | try { |
| 93 | - syncChuZhen(pid, id, mongoTemplate,lastMenses,weeks); | |
| 113 | + syncChuZhen(pid, id, mongoTemplate, lastMenses, weeks); | |
| 94 | 114 | syncFuzhen(pid, id, mongoTemplate,lastMenses,weeks); |
| 95 | 115 | } catch (Exception e) { |
| 96 | 116 | ExceptionUtils.catchException(e, "SyncAntExChu thread error.id:" + id+",pid:"+pid); |
| ... | ... | @@ -333,7 +353,7 @@ |
| 333 | 353 | person.setPhone(DataUtil.getString(map.get("P_MOBILEPHONE"))); |
| 334 | 354 | person.setCreated(DataUtil.getDate(map.get("P_FILINGTIME"))); |
| 335 | 355 | person.setModified(DataUtil.getDate(map.get("P_OPERTIME"))); |
| 336 | - mongoTemplate.save(person); | |
| 356 | + // mongoTemplate.save(person); | |
| 337 | 357 | |
| 338 | 358 | |
| 339 | 359 | patients.setPid(person.getId()); |
| ... | ... | @@ -640,7 +660,7 @@ |
| 640 | 660 | patients.setVcCardNo(DataUtil.getString(map.get("VC_CARDNO"))); //就诊卡号 |
| 641 | 661 | |
| 642 | 662 | |
| 643 | - mongoTemplate.save(patients); | |
| 663 | + // mongoTemplate.save(patients); | |
| 644 | 664 | System.out.println(patients.getId() + "============"); |
| 645 | 665 | |
| 646 | 666 | patientsQueue.add(new SimplePatient(person.getId(), patients.getId(),DataUtil.getDate(map.get("P_LASTMENSTRUALPERIOD")),weeks)); |
platform-sync-data/src/main/java/com/lyms/platform/sync/data/util/JDBCUtil.java
View file @
ef0891f
| 1 | 1 | package com.lyms.platform.sync.data.util; |
| 2 | 2 | |
| 3 | +import com.lyms.platform.common.utils.PropertiesUtils; | |
| 4 | + | |
| 3 | 5 | import java.sql.*; |
| 4 | 6 | import java.util.ArrayList; |
| 5 | 7 | import java.util.HashMap; |
| 6 | 8 | |
| ... | ... | @@ -11,13 +13,21 @@ |
| 11 | 13 | */ |
| 12 | 14 | public class JDBCUtil { |
| 13 | 15 | |
| 16 | + static String oracle_url = PropertiesUtils.getPropertyValue("oracle.url"); | |
| 17 | + static String oracle_name = PropertiesUtils.getPropertyValue("oracle.name"); | |
| 18 | + static String oracle_pwd = PropertiesUtils.getPropertyValue("oracle.pwd"); | |
| 19 | + | |
| 20 | + static String mysql_url = PropertiesUtils.getPropertyValue("mysql.url"); | |
| 21 | + static String mysql_name = PropertiesUtils.getPropertyValue("mysql.name"); | |
| 22 | + static String mysql_pwd = PropertiesUtils.getPropertyValue("mysql.pwd"); | |
| 23 | + | |
| 14 | 24 | public static Connection getOracleConnection() { |
| 15 | 25 | Connection con = null; |
| 16 | 26 | try { |
| 17 | 27 | Class.forName("oracle.jdbc.driver.OracleDriver"); |
| 18 | - String url = "jdbc:oracle:thin:@119.90.57.27:1521:orcl"; | |
| 19 | - String userName = "lyms_21"; | |
| 20 | - String pwd = "LYMS_21"; | |
| 28 | + String url = oracle_url; | |
| 29 | + String userName = oracle_name; | |
| 30 | + String pwd = oracle_pwd; | |
| 21 | 31 | con = DriverManager.getConnection(url, userName, pwd); |
| 22 | 32 | } catch (Exception e) { |
| 23 | 33 | e.printStackTrace(); |
| 24 | 34 | |
| ... | ... | @@ -25,27 +35,13 @@ |
| 25 | 35 | return con; |
| 26 | 36 | } |
| 27 | 37 | |
| 28 | - public static Connection getMysqlConnectionForNewPlatform() { | |
| 29 | - Connection con = null; | |
| 30 | - try { | |
| 31 | - Class.forName("com.mysql.jdbc.Driver"); | |
| 32 | - String url = "jdbc:mysql://119.90.57.26:3306/center?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8"; | |
| 33 | - String userName = "center"; | |
| 34 | - String pwd = "lyms2015"; | |
| 35 | - con = DriverManager.getConnection(url, userName, pwd); | |
| 36 | - } catch (Exception e) { | |
| 37 | - e.printStackTrace(); | |
| 38 | - } | |
| 39 | - return con; | |
| 40 | - } | |
| 41 | - | |
| 42 | 38 | public static Connection getMysqlConnection() { |
| 43 | 39 | Connection con = null; |
| 44 | 40 | try { |
| 45 | 41 | Class.forName("com.mysql.jdbc.Driver"); |
| 46 | - String url = "jdbc:mysql://192.168.1.39:3306/platform?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8"; | |
| 47 | - String userName = "platform"; | |
| 48 | - String pwd = "platform123"; | |
| 42 | + String url = mysql_url; | |
| 43 | + String userName = mysql_name; | |
| 44 | + String pwd = mysql_pwd; | |
| 49 | 45 | con = DriverManager.getConnection(url, userName, pwd); |
| 50 | 46 | } catch (Exception e) { |
| 51 | 47 | e.printStackTrace(); |
platform-sync-data/src/main/java/com/lyms/platform/sync/data/web/controller/SyncDataController.java
View file @
ef0891f
| ... | ... | @@ -44,5 +44,13 @@ |
| 44 | 44 | return "baby starting..........."; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | + | |
| 48 | + @RequestMapping(value = "/delete", method = RequestMethod.GET) | |
| 49 | + @ResponseBody | |
| 50 | + public String deleteData(@RequestParam(required = true) String hospitalId,@RequestParam(required = false) String pid) { | |
| 51 | + syncDataService.deleteData(hospitalId,pid); | |
| 52 | + return "delete starting..........."; | |
| 53 | + } | |
| 54 | + | |
| 47 | 55 | } |
platform-sync-data/src/main/resources/config.properties
View file @
ef0891f
| 1 | +oracle.url=jdbc:oracle:thin:@119.90.57.27:1521:orcl | |
| 2 | +oracle.name=LYMS_QHDCESHI8 | |
| 3 | +oracle.pwd=LYMS_QHDCESHI8 | |
| 4 | + | |
| 5 | +#oracle.name=lyms_21 | |
| 6 | +#oracle.pwd=LYMS_21 | |
| 7 | + | |
| 8 | +mysql.url=jdbc:mysql://192.168.1.39:3306/platform?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8 | |
| 9 | +mysql.name=platform | |
| 10 | +mysql.pwd=platform123 |
platform-sync-data/src/main/resources/database.properties
View file @
ef0891f
platform-sync-data/src/main/resources/spring/applicationContext-mvc.xml
View file @
ef0891f
platform-sync-data/src/main/resources/spring/spring-mongodb.xml
View file @
ef0891f
| ... | ... | @@ -7,21 +7,35 @@ |
| 7 | 7 | http://www.springframework.org/schema/beans |
| 8 | 8 | http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> |
| 9 | 9 | |
| 10 | + <bean id="configProperties" | |
| 11 | + class="org.springframework.beans.factory.config.PropertiesFactoryBean"> | |
| 12 | + <property name="locations"> | |
| 13 | + <list> | |
| 14 | + <value>classpath:database.properties</value> | |
| 15 | + </list> | |
| 16 | + </property> | |
| 17 | + </bean> | |
| 18 | + <bean id="propertyConfigurer" | |
| 19 | + class="org.springframework.beans.factory.config.PreferencesPlaceholderConfigurer"> | |
| 20 | + <property name="properties" ref="configProperties" /> | |
| 21 | + </bean> | |
| 22 | + | |
| 23 | + | |
| 10 | 24 | <bean name="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate"> |
| 11 | 25 | <constructor-arg name="mongo" ref="mongo"/> |
| 12 | 26 | <constructor-arg name="userCredentials" ref="userCredentials"/> |
| 13 | - <constructor-arg name="databaseName" value="sync-platform-data"/> | |
| 27 | + <constructor-arg name="databaseName" value="${mongo.db.dbname}"/> | |
| 14 | 28 | </bean> |
| 15 | 29 | |
| 16 | 30 | |
| 17 | 31 | <bean id="userCredentials" class="org.springframework.data.authentication.UserCredentials"> |
| 18 | - <constructor-arg name="username" value="platform"/> | |
| 19 | - <constructor-arg name="password" value="platform123"/> | |
| 32 | + <constructor-arg name="username" value="${mongo.db.username}"/> | |
| 33 | + <constructor-arg name="password" value="${mongo.db.password}"/> | |
| 20 | 34 | </bean> |
| 21 | 35 | |
| 22 | 36 | <mongo:db-factory mongo-ref="mongo" id="mongoDbFactory"/> |
| 23 | 37 | |
| 24 | - <mongo:mongo id="mongo" host="119.90.57.26" port="10001"> | |
| 38 | + <mongo:mongo id="mongo" host="${mongo.db.host}" port="${mongo.db.port}"> | |
| 25 | 39 | <mongo:options connections-per-host="50" |
| 26 | 40 | write-number="1" |
| 27 | 41 | write-timeout="0" write-fsync="true"/> |