Commit 20ba413e4925ab675d419a139bf216c2933587f1
1 parent
06fe45cff5
Exists in
master
and in
6 other branches
承德获取病人ID
Showing 2 changed files with 91 additions and 0 deletions
platform-operate-api/src/main/java/com/lyms/hospitalapi/Cdfy/CdfyHisService.java
View file @
20ba413
| 1 | +package com.lyms.hospitalapi.Cdfy; | |
| 2 | + | |
| 3 | +import com.lyms.hospitalapi.pojo.DzReplace; | |
| 4 | +import com.lyms.platform.common.utils.ExceptionUtils; | |
| 5 | +import org.apache.commons.collections.CollectionUtils; | |
| 6 | +import org.apache.commons.dbutils.DbUtils; | |
| 7 | +import org.apache.commons.dbutils.QueryRunner; | |
| 8 | +import org.apache.commons.dbutils.handlers.BeanListHandler; | |
| 9 | +import org.apache.commons.lang.StringUtils; | |
| 10 | + | |
| 11 | +import java.sql.Connection; | |
| 12 | +import java.util.ArrayList; | |
| 13 | +import java.util.List; | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * Created by Administrator on 2017/9/8. | |
| 17 | + */ | |
| 18 | +public class CdfyHisService { | |
| 19 | + | |
| 20 | + | |
| 21 | + /** | |
| 22 | + * 承德 | |
| 23 | + * 查询病人ID | |
| 24 | + * @param vcCardNo 就诊卡号 | |
| 25 | + * @return | |
| 26 | + */ | |
| 27 | + public DzReplace findAllVcCarddNo(String vcCardNo){ | |
| 28 | + | |
| 29 | + List<DzReplace> dzReplace = new ArrayList<DzReplace>(); | |
| 30 | + if (StringUtils.isNotBlank(vcCardNo)){ | |
| 31 | + | |
| 32 | + System.out.println("vcCardNo = " + vcCardNo); | |
| 33 | + Connection conn = com.lyms.hospitalapi.Cdfy.ConnTools.makeHisConnection(); | |
| 34 | + QueryRunner queryRunner = new QueryRunner(true); | |
| 35 | + String sql = "select id as id from cdfyhis.v_patientinfo where cardno = '"+vcCardNo+"'"; | |
| 36 | + | |
| 37 | + try | |
| 38 | + { | |
| 39 | + dzReplace = queryRunner.query(conn,sql,new BeanListHandler<DzReplace>(DzReplace.class)); | |
| 40 | + | |
| 41 | + } | |
| 42 | + catch (Exception e) | |
| 43 | + { | |
| 44 | + DbUtils.closeQuietly(conn); | |
| 45 | + ExceptionUtils.catchException(e, "cd his exception "); | |
| 46 | + } | |
| 47 | + finally | |
| 48 | + { | |
| 49 | + DbUtils.closeQuietly(conn); | |
| 50 | + } | |
| 51 | + | |
| 52 | + } | |
| 53 | + | |
| 54 | + return dzReplace.get(0); | |
| 55 | + | |
| 56 | + } | |
| 57 | + | |
| 58 | +} |
platform-operate-api/src/main/java/com/lyms/hospitalapi/Cdfy/ConnTools.java
View file @
20ba413
| 1 | +package com.lyms.hospitalapi.Cdfy; | |
| 2 | + | |
| 3 | +import java.sql.Connection; | |
| 4 | +import java.sql.DriverManager; | |
| 5 | +import java.sql.SQLException; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * Created by Administrator on 2017/9/8. | |
| 9 | + */ | |
| 10 | +public class ConnTools { | |
| 11 | + | |
| 12 | + private static String hisDirverClassName = "oracle.jdbc.driver.OracleDriver"; | |
| 13 | + private static String hisUrl = "jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.200.10)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = racdb)))"; | |
| 14 | + private static String hisUser = "interfacemmbb"; | |
| 15 | + private static String hisPassword = "his"; | |
| 16 | + | |
| 17 | + | |
| 18 | + public static Connection makeHisConnection() { | |
| 19 | + Connection conn = null; | |
| 20 | + try { | |
| 21 | + Class.forName(hisDirverClassName); | |
| 22 | + } catch (ClassNotFoundException e) { | |
| 23 | + e.printStackTrace(); | |
| 24 | + } | |
| 25 | + try { | |
| 26 | + conn = DriverManager.getConnection(hisUrl, hisUser, hisPassword); | |
| 27 | + } catch (SQLException e) { | |
| 28 | + e.printStackTrace(); | |
| 29 | + } | |
| 30 | + return conn; | |
| 31 | + } | |
| 32 | + | |
| 33 | +} |