Commit 9d734fa4c53f2bed0c050e08a700f5dbfda0a788

Authored by liquanyu
1 parent 6e40db3b1f

修改数据库ip

Showing 10 changed files with 228 additions and 10 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/MongoSyncService.java View file @ 9d734fa
... ... @@ -335,7 +335,7 @@
335 335 classList.add(SieveResultModel.class);
336 336 classList.add(StopPregModel.class);
337 337 try {
338   - Mongo mongo = new Mongo("119.90.57.26", 10001);
  338 + Mongo mongo = new Mongo("111.206.6.150", 10001);
339 339 MongoTemplate template = new MongoTemplate(mongo, "sync-platform-data");
340 340 template.getDb().authenticate("platform", "platform123".toCharArray());
341 341 Query query = null;
platform-biz-patient-service/src/main/resources/database.properties View file @ 9d734fa
1   -mongo.db.host=119.90.57.26
  1 +mongo.db.host=111.206.6.150
2 2 mongo.db.port=10001
3 3 mongo.db.dbname=platform
4 4 mongo.db.username=platform
platform-common/src/main/java/com/lyms/platform/common/Test.java View file @ 9d734fa
... ... @@ -4,7 +4,8 @@
4 4 import com.lyms.platform.common.utils.DateUtil;
5 5 import com.lyms.platform.common.utils.StringUtils;
6 6  
7   -import java.io.UnsupportedEncodingException;
  7 +import java.io.*;
  8 +import java.net.Socket;
8 9 import java.util.Arrays;
9 10 import java.util.Calendar;
10 11 import java.util.Date;
... ... @@ -12,8 +13,27 @@
12 13 public class Test {
13 14  
14 15 public static void main(String[] args) throws UnsupportedEncodingException {
15   - System.out.println(DateUtil.getyyyy_MM_dd_hms(getStartTime()));
16   - System.out.println(DateUtil.getyyyy_MM_dd_hms(getEndTime()));
  16 + Socket socket=null;
  17 + PrintWriter out=null;
  18 + BufferedReader in=null;
  19 + String serverIP="127.0.0.1"; //服务器端ip地址
  20 + int port=9999; //服务器端端口号
  21 + try
  22 + {
  23 + socket=new Socket(serverIP,port);
  24 + in=new BufferedReader(new InputStreamReader(socket.getInputStream()));
  25 + out=new PrintWriter(socket.getOutputStream(),true);
  26 +
  27 + int number=(int)(Math.random()*10)+1;
  28 + System.out.println("客户端正在发送的内容为:"+number);
  29 + out.println(number);
  30 + Thread.sleep(2000);
  31 + }
  32 + catch(IOException | InterruptedException e)
  33 + {
  34 + // TODO 自动生成的 catch 块
  35 + e.printStackTrace();
  36 + }
17 37 }
18 38  
19 39 private static Date getStartTime() {
platform-job-index/src/main/java/com/lyms/platform/job/index/util/JDBCUtil.java View file @ 9d734fa
... ... @@ -29,7 +29,7 @@
29 29 Connection con = null;
30 30 try {
31 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";
  32 + String url = "jdbc:mysql://111.206.6.150:3306/center?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8";
33 33 String userName = "center";
34 34 String pwd = "lyms2015";
35 35 con = DriverManager.getConnection(url, userName, pwd);
platform-job-index/src/main/resources/spring/spring-mongodb.xml View file @ 9d734fa
... ... @@ -21,7 +21,7 @@
21 21  
22 22 <mongo:db-factory mongo-ref="mongo" id="mongoDbFactory"/>
23 23  
24   - <mongo:mongo id="mongo" host="119.90.57.26" port="10001">
  24 + <mongo:mongo id="mongo" host="111.206.6.150" port="10001">
25 25 <mongo:options connections-per-host="50"
26 26 write-number="1"
27 27 write-timeout="0" write-fsync="true"/>
platform-operate-api/src/main/java/com/lyms/hospitalapi/hs/JDBCUtil.java View file @ 9d734fa
... ... @@ -16,7 +16,7 @@
16 16 static String oracle_url = "jdbc:oracle:thin:@172.16.7.250:1521:prmi";
17 17 static String oracle_name = "LYMS_HENGSHUI_ZHENGSHI";
18 18 static String oracle_pwd = "lyms2018";
19   -// static String oracle_url = "jdbc:oracle:thin:@119.90.57.26:1522:orcl";
  19 +// static String oracle_url = "jdbc:oracle:thin:@111.206.6.150:1522:orcl";
20 20 // static String oracle_name = "LYMS_ODS";
21 21 // static String oracle_pwd = "Welcome1";
22 22  
platform-operate-api/src/main/java/com/lyms/hospitalapi/lcdcf/ConnTools.java View file @ 9d734fa
... ... @@ -14,7 +14,7 @@
14 14 private static String hisPassword = "LYMS_123";
15 15  
16 16 // private static String hisDirverClassName = "com.mysql.jdbc.Driver";
17   -// private static String hisUrl = "jdbc:mysql://119.90.57.26:3306/platform?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8";
  17 +// private static String hisUrl = "jdbc:mysql://111.206.6.150:3306/platform?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8";
18 18 // private static String hisUser = "platform";
19 19 // private static String hisPassword = "platform123";
20 20  
platform-operate-api/src/main/java/com/lyms/hospitalapi/qhdfy/LisWorkerService.java View file @ 9d734fa
  1 +package com.lyms.hospitalapi.qhdfy;
  2 +
  3 +import com.lyms.platform.common.utils.ExceptionUtils;
  4 +import org.springframework.beans.factory.InitializingBean;
  5 +import org.springframework.stereotype.Service;
  6 +
  7 +import java.io.*;
  8 +import java.net.ServerSocket;
  9 +import java.net.Socket;
  10 +@Service
  11 +public class LisWorkerService implements InitializingBean {
  12 +
  13 + @Override
  14 + public void afterPropertiesSet() throws Exception {
  15 + //receiveLis();
  16 + }
  17 +
  18 + public static void main(String[] args) {
  19 + serverSocket();
  20 + }
  21 +
  22 + public static void serverSocket()
  23 + {
  24 + try {
  25 + ExceptionUtils.catchException("客户端连接过来了,准备接收数据");
  26 + ServerSocket serverSocket = new ServerSocket(9999);
  27 + while (true) {
  28 + Socket socket = serverSocket.accept();
  29 + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(socket.getInputStream(), "UTF-8"));
  30 + //读取一行数据
  31 + String str;
  32 +
  33 + while ( socket.isClosed() && (str = bufferedReader.readLine()) != null) {
  34 + System.out.println(str);
  35 + }
  36 + socket.close();
  37 + }
  38 + } catch (IOException e) {
  39 + e.printStackTrace();
  40 + }finally {
  41 +
  42 + }
  43 + }
  44 +
  45 +
  46 + public void receiveLis()
  47 + {
  48 + Socket socket = null;
  49 + InputStream inputStream = null;
  50 + BufferedReader br = null;
  51 + try {
  52 + //创建Socket对象
  53 + //下面的代码无异常,去连接服务端
  54 + System.out.println("客户端准备连接服务端……");
  55 + socket = new Socket("127.0.0.1", 9999);
  56 + System.out.println("连接服务器成功,准备发送数据");
  57 + ExceptionUtils.catchException("连接服务器成功,准备发送数据");
  58 + //获取输入流(字节输入流)
  59 + inputStream = socket.getInputStream();
  60 + //创建BufferedReader对象
  61 + br = new BufferedReader(new InputStreamReader(inputStream));
  62 + //创建Scanner对象读取,来读取控制台的数据
  63 + //循环读写数据
  64 + while (true) {
  65 + //读(阻塞数据)
  66 + read(br);
  67 + }
  68 + } catch (IOException e) {
  69 + ExceptionUtils.catchException("连接socket异常:" + e.getMessage());
  70 + } finally {
  71 + //关闭资源
  72 + close(br);
  73 + close(inputStream);
  74 + close(socket);
  75 + }
  76 + }
  77 + private static String read(BufferedReader br) {
  78 + String s = null;
  79 + try {
  80 + //读取一行数据
  81 + s = br.readLine();
  82 + System.out.println("您接收到的数据为:" + s);
  83 + ExceptionUtils.catchException("您接收到的数据为:" + s);
  84 + return s;
  85 + } catch (IOException e) {
  86 + ExceptionUtils.catchException("接收数据异常:" + e.getMessage());
  87 + }
  88 + return "";
  89 + }
  90 + public static void close(Writer w) {
  91 + if (w != null) {
  92 + try {
  93 + w.close();
  94 + } catch (IOException e) {
  95 + e.printStackTrace();
  96 + }
  97 + }
  98 + }
  99 +
  100 + public static void close(Reader r) {
  101 + if (r != null) {
  102 + try {
  103 + r.close();
  104 + } catch (IOException e) {
  105 + e.printStackTrace();
  106 + }
  107 + }
  108 + }
  109 +
  110 + public static void close(OutputStream os) {
  111 + if (os != null) {
  112 + try {
  113 + os.close();
  114 + } catch (IOException e) {
  115 + e.printStackTrace();
  116 + }
  117 + }
  118 + }
  119 +
  120 + public static void close(InputStream is) {
  121 + if (is != null) {
  122 + try {
  123 + is.close();
  124 + } catch (IOException e) {
  125 + e.printStackTrace();
  126 + }
  127 + }
  128 + }
  129 +
  130 + public static void close(Socket socket) {
  131 + if (socket != null) {
  132 + try {
  133 + socket.close();
  134 + } catch (IOException e) {
  135 + e.printStackTrace();
  136 + }
  137 + }
  138 + }
  139 +
  140 + public static void close(ServerSocket serverSocket) {
  141 + if (serverSocket != null) {
  142 + try {
  143 + serverSocket.close();
  144 + } catch (IOException e) {
  145 + e.printStackTrace();
  146 + }
  147 + }
  148 + }
  149 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java View file @ 9d734fa
... ... @@ -5155,5 +5155,53 @@
5155 5155 public String convertBase64(String imgUrl) throws Exception {
5156 5156 return LymsEncodeUtil.imgConvertBase64(imgUrl);
5157 5157 }
  5158 +
  5159 + @RequestMapping(method = RequestMethod.GET, value = "/getFmDatas")
  5160 + @ResponseBody
  5161 + public void getFmDatas(String areaId,String start,String end,HttpServletResponse httpServletResponse) throws Exception {
  5162 + Criteria criteria = new Criteria();
  5163 + criteria.and("yn").is(YnEnums.YES.getId());//有效数据
  5164 + criteria.and("fmHospital").exists(true);
  5165 + criteria.and("fmDate").gte(DateUtil.parseYMD(start)).lte(DateUtil.parseYMD(end));
  5166 + criteria.and("isAutoFm").is(0);
  5167 + criteria.and("deliverDoctor").exists(true);
  5168 + criteria.and("areaId").is(areaId);
  5169 + Query query = new Query(criteria);
  5170 + System.out.println(query.toString());
  5171 + List<Patients> patients = mongoTemplate.find(query, Patients.class);
  5172 + List<Map<String, Object>> list = new ArrayList<>();
  5173 + if (CollectionUtils.isNotEmpty(patients))
  5174 + {
  5175 + for (Patients pat : patients)
  5176 + {
  5177 + Map<String, Object> map = new HashMap();
  5178 + String street = "";
  5179 + String s = pat.getStreetId();
  5180 + if (StringUtils.isNotEmpty(s))
  5181 + {
  5182 + BasicConfig b = basicConfigService.getOneBasicConfigById(s);
  5183 + street = b.getName();
  5184 + }
  5185 + map.put("street",street);
  5186 + map.put("phone", com.lyms.platform.common.utils.StringUtils.encryPhone(pat.getPhone()));
  5187 + map.put("age",DateUtil.getAge2(pat.getFmDate(),new Date()));
  5188 + list.add(map);
  5189 + }
  5190 + }
  5191 +
  5192 +
  5193 + OutputStream out = httpServletResponse.getOutputStream();
  5194 + Map <String, String> cnames = new LinkedHashMap <>();
  5195 + cnames.put("street", "乡镇");
  5196 + cnames.put("phone", "手机号码");
  5197 + cnames.put("age", "年龄");
  5198 + httpServletResponse.setContentType("application/octet-stream");
  5199 + httpServletResponse.setCharacterEncoding("UTF-8");
  5200 + httpServletResponse.setHeader("Content-Disposition", "attachment;fileName=" + "区县儿童数据.xls");
  5201 + ExcelUtil.toExcel(out, list, cnames);
  5202 +
  5203 + }
  5204 +
  5205 +
5158 5206 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/LpJdbcUtil.java View file @ 9d734fa
... ... @@ -19,7 +19,7 @@
19 19 Connection con = null;
20 20 try {
21 21 Class.forName("com.mysql.jdbc.Driver");
22   - String url = "jdbc:mysql://119.90.57.26:3306/platform?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8";
  22 + String url = "jdbc:mysql://111.206.6.150:3306/platform?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8";
23 23 String userName = "platform";
24 24 String pwd = "platform123";
25 25 con = DriverManager.getConnection(url, userName, pwd);