From 9449b5f71bd0c20ed9aefd025ee87c69bcdfbd40 Mon Sep 17 00:00:00 2001 From: zhaowenxuan <chacca165@163.com> Date: 星期三, 18 十二月 2024 14:51:12 +0800 Subject: [PATCH] 20241218 --- src/main/java/com/example/config/RedisConfig.java | 98 +---- /dev/null | 11 src/main/java/com/example/service/HisService.java | 200 +++++++++++ src/main/java/com/example/config/DruidConfig.java | 141 +------ src/main/java/com/example/service/xian/MeiJiHisService.java | 231 +++++------- src/main/java/com/example/config/ConfigValue.java | 54 +++ src/main/java/com/example/controller/HisController.java | 274 +++++++++++++++ src/main/java/com/example/factory/ServiceFactory.java | 44 ++ 8 files changed, 726 insertions(+), 327 deletions(-) diff --git a/src/main/java/com/example/config/ConfigValue.java b/src/main/java/com/example/config/ConfigValue.java new file mode 100644 index 0000000..7b58bd2 --- /dev/null +++ b/src/main/java/com/example/config/ConfigValue.java @@ -0,0 +1,54 @@ +package com.example.config; + +import cn.hutool.json.JSONUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +/** + * @Company: 瑗垮畨璺嘲绉戞妧鏈夐檺鍏徃 + * @Author: zhaowenxuan + * @Date: 2024/12/17 20:26 + */ +@Slf4j +@Component +public class ConfigValue { + @Value("${config.path}") + private String CONFIG_PATH; + @Value("${config.dir}") + private String CONFIG_DIR; + private Map<String, String> configMap = new HashMap<>(); + + @PostConstruct + private void init(){ + Properties props = new Properties(); + FileInputStream fis = null; + try { + fis = new FileInputStream(CONFIG_PATH); + props.load(fis); + fis.close(); + for (String key : props.stringPropertyNames()) { + configMap.put(key, props.getProperty(key)); + } + log.info("閰嶇疆 -> {}", JSONUtil.toJsonStr(configMap)); + } catch (IOException e) { + throw new RuntimeException("鎵句笉鍒伴厤缃枃浠舵垨鍔犺浇寮傚父"); + } + } + + public Map<String, String> getConfigMap() { + return configMap; + } + + public String getConfigValue(String key) { + return configMap.get(key); + } +} diff --git a/src/main/java/com/example/config/DruidConfig.java b/src/main/java/com/example/config/DruidConfig.java index 9671b24..a444748 100644 --- a/src/main/java/com/example/config/DruidConfig.java +++ b/src/main/java/com/example/config/DruidConfig.java @@ -8,6 +8,7 @@ import com.example.enums.DataSourceType; import com.example.utils.SpringUtils; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.web.servlet.FilterRegistrationBean; @@ -31,79 +32,27 @@ @Slf4j @Configuration public class DruidConfig { - - @Value("${config.path}") - private String CONFIG_PATH; - @Value("${config.dir}") - private String CONFIG_DIR; + @Autowired + private ConfigValue configValue; private DruidDataSource dataSource; @Bean public DataSource masterDataSource(DruidProperties druidProperties){ dataSource = DruidDataSourceBuilder.create().build(); - Properties props = new Properties(); + Map<String, String> configMap = configValue.getConfigMap(); try { - // 浠庢枃浠朵腑璇诲彇閰嶇疆淇℃伅 - FileInputStream fis = null; - try { - fis = new FileInputStream(CONFIG_PATH); - } catch (FileNotFoundException e) { - log.info("鏁版嵁搴撹繛鎺ユ枃浠舵壘涓嶅埌 绯荤粺姝e湪鍒涘缓锛�"); - File f = new File(CONFIG_DIR); - if(!f.exists()){ - f.mkdirs(); - } - File file = new File(CONFIG_PATH); - try { - FileWriter fileWriter = new FileWriter(file); - fileWriter.write("ip = 浣犵殑涓绘暟鎹簱杩炴帴ip鍦板潃\n"); - fileWriter.write("prot = 浣犵殑涓绘暟鎹簱杩炴帴绔彛\n"); - fileWriter.write("name = 浣犵殑涓绘暟鎹簱杩炴帴鍚嶇О\n"); - fileWriter.write("username = 浣犵殑涓绘暟鎹簱杩炴帴鐢ㄦ埛鍚峔n"); - fileWriter.write("password = 浣犵殑涓绘暟鎹簱杩炴帴瀵嗙爜\n"); - fileWriter.write("\n"); - fileWriter.write("hisenabled = 鏄惁寮�鍚� his 浠庡簱鏁版嵁搴撹繛鎺� (浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴 fales)\n"); - fileWriter.write("hisip = 浣犵殑 his 鏁版嵁搴撹繛鎺p鍦板潃\n"); - fileWriter.write("hisprot = 浣犵殑 his 鏁版嵁搴撹繛鎺ョ鍙n"); - fileWriter.write("hisname = 浣犵殑 his 鏁版嵁搴撹繛鎺ュ悕绉癨n"); - fileWriter.write("hisusername = 浣犵殑 his 鏁版嵁搴撹繛鎺ョ敤鎴峰悕\n"); - fileWriter.write("hispassword = 浣犵殑 his 鏁版嵁搴撹繛鎺ュ瘑鐮乗n"); - fileWriter.write("\n"); - fileWriter.write("pacsenabled = 鏄惁寮�鍚痯acs浠庡簱鏁版嵁搴撹繛鎺� (浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴 fales)\n"); - fileWriter.write("pacsip = 浣犵殑pacs鏁版嵁搴撹繛鎺p鍦板潃\n"); - fileWriter.write("pacsprot = 浣犵殑pacs鏁版嵁搴撹繛鎺ョ鍙n"); - fileWriter.write("pacsname = 浣犵殑pacs鏁版嵁搴撹繛鎺ュ悕绉癨n"); - fileWriter.write("pacsusername = 浣犵殑pacs鏁版嵁搴撹繛鎺ョ敤鎴峰悕\n"); - fileWriter.write("pacspassword = 浣犵殑pacs鏁版嵁搴撹繛鎺ュ瘑鐮乗n"); - fileWriter.write("\n"); - fileWriter.write("lisenabled = 鏄惁寮�鍚� lis 浠庡簱鏁版嵁搴撹繛鎺� (浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴 fales)\n"); - fileWriter.write("lisip = 浣犵殑 lis 鏁版嵁搴撹繛鎺p鍦板潃\n"); - fileWriter.write("lisprot = 浣犵殑 lis 鏁版嵁搴撹繛鎺ョ鍙n"); - fileWriter.write("lisname = 浣犵殑 lis 鏁版嵁搴撹繛鎺ュ悕绉癨n"); - fileWriter.write("lisusername = 浣犵殑 lis 鏁版嵁搴撹繛鎺ョ敤鎴峰悕\n"); - fileWriter.write("lispassword = 浣犵殑 lis 鏁版嵁搴撹繛鎺ュ瘑鐮乗n"); - fileWriter.close(); - log.info("鏁版嵁搴撹繛鎺ユ枃浠跺垱寤烘垚鍔燂紒"); - } catch (IOException ioException) { - log.info("鏁版嵁搴撹繛鎺ユ枃浠跺垱寤哄け璐� 璇疯仈绯荤鐞嗗憳鎵嬪姩鍒涘缓锛�"); - ioException.printStackTrace(); - } - e.printStackTrace(); - } - props.load(fis); - fis.close(); // 鑾峰彇灞炴�у�煎苟璧嬪�� Properties properties = new Properties(); // 杩欓噷鏄祴璇曞啓娉曪紝鍏蜂綋鐨剉alue鍙互閫氳繃璇锋眰鍙傛暟浼犻�掕繃鏉� - properties.setProperty("druid.url","jdbc:mysql://"+props.getProperty("ip")+":"+props.getProperty("prot")+"/"+props.getProperty("name")+"" + + properties.setProperty("druid.url","jdbc:mysql://"+configMap.get("ip")+":"+configMap.get("prot")+"/"+configMap.get("name")+"" + "?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8"); - properties.setProperty("druid.username",props.getProperty("username")); - properties.setProperty("druid.password",props.getProperty("password")); + properties.setProperty("druid.username",configMap.get("username")); + properties.setProperty("druid.password",configMap.get("password")); dataSource.restart(properties); log.info("鏁版嵁搴撹繛鎺ユ垚鍔�!!!"); } catch (Exception e) { - log.info("鏁版嵁搴撹繛鎺ュけ璐� 璇疯仈绯荤鐞嗗憳锛�"); + log.error("鏁版嵁搴撹繛鎺ュけ璐� 璇疯仈绯荤鐞嗗憳锛�"); e.printStackTrace(); } return druidProperties.dataSource(dataSource); @@ -114,31 +63,21 @@ // @ConditionalOnProperty(prefix = "spring.datasource.druid.slavehis", name = "enabled", havingValue = "true") public DataSource slaveHisDataSource(DruidProperties druidProperties) { DruidDataSource dataSource = DruidDataSourceBuilder.create().build(); - Properties props = new Properties(); + Map<String, String> configMap = configValue.getConfigMap(); + // 鑾峰彇灞炴�у�煎苟璧嬪�� + Properties properties = new Properties(); + // 杩欓噷鏄祴璇曞啓娉曪紝鍏蜂綋鐨剉alue鍙互閫氳繃璇锋眰鍙傛暟浼犻�掕繃鏉� + properties.setProperty("druid.enabled",configMap.get("hisenabled")); + properties.setProperty("druid.driverClassName","com.microsoft.sqlserver.jdbc.SQLServerDriver"); + properties.setProperty("druid.url","jdbc:sqlserver://"+configMap.get("hisip")+":"+configMap.get("hisprot")+";DatabaseName="+configMap.get("hisname")+ + ";&characterEncoding=utf8"); + properties.setProperty("druid.username",configMap.get("hisusername")); + properties.setProperty("druid.password",configMap.get("hispassword")); try { - // 浠庢枃浠朵腑璇诲彇閰嶇疆淇℃伅 - FileInputStream fis = null; - try { - fis = new FileInputStream(CONFIG_PATH); - } catch (FileNotFoundException e) { - log.info("鏁版嵁搴撹繛鎺ユ枃浠舵壘涓嶅埌锛�"); - } - props.load(fis); - fis.close(); - // 鑾峰彇灞炴�у�煎苟璧嬪�� - Properties properties = new Properties(); - // 杩欓噷鏄祴璇曞啓娉曪紝鍏蜂綋鐨剉alue鍙互閫氳繃璇锋眰鍙傛暟浼犻�掕繃鏉� - properties.setProperty("druid.enabled",props.getProperty("hisenabled")); - properties.setProperty("druid.driverClassName","com.microsoft.sqlserver.jdbc.SQLServerDriver"); - properties.setProperty("druid.url","jdbc:sqlserver://"+props.getProperty("hisip")+":"+props.getProperty("hisprot")+";DatabaseName="+props.getProperty("hisname")+ - ";&characterEncoding=utf8"); - properties.setProperty("druid.username",props.getProperty("hisusername")); - properties.setProperty("druid.password",props.getProperty("hispassword")); dataSource.restart(properties); log.info("his鏁版嵁搴撹繛鎺ユ垚鍔�!!!"); - } catch (Exception e) { - log.info("鏁版嵁搴撹繛鎺ュけ璐� 璇疯仈绯荤鐞嗗憳锛�"); - e.printStackTrace(); + } catch (SQLException e) { + log.error("his鏁版嵁搴撹繛鎺ュけ璐�!!!"); } return druidProperties.dataSource(dataSource); } @@ -148,29 +87,20 @@ // @ConditionalOnProperty(prefix = "spring.datasource.druid.slavelis", name = "enabled", havingValue = "true") public DataSource slaveDataLisSource(DruidProperties druidProperties) { DruidDataSource dataSource = DruidDataSourceBuilder.create().build(); - Properties props = new Properties(); + Map<String, String> configMap = configValue.getConfigMap(); try { - // 浠庢枃浠朵腑璇诲彇閰嶇疆淇℃伅 - FileInputStream fis = null; - try { - fis = new FileInputStream(CONFIG_PATH); - } catch (FileNotFoundException e) { - log.info("鏁版嵁搴撹繛鎺ユ枃浠舵壘涓嶅埌锛�"); - } - props.load(fis); - fis.close(); // 鑾峰彇灞炴�у�煎苟璧嬪�� Properties properties = new Properties(); // 杩欓噷鏄祴璇曞啓娉曪紝鍏蜂綋鐨剉alue鍙互閫氳繃璇锋眰鍙傛暟浼犻�掕繃鏉� - properties.setProperty("druid.enabled",props.getProperty("lisenabled")); - properties.setProperty("druid.url","jdbc:mysql://"+props.getProperty("lisip")+":"+props.getProperty("lisprot")+"/"+props.getProperty("lisname")+"" + + properties.setProperty("druid.enabled",configMap.get("lisenabled")); + properties.setProperty("druid.url","jdbc:mysql://"+configMap.get("lisip")+":"+configMap.get("lisprot")+"/"+configMap.get("lisname")+"" + "?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8"); - properties.setProperty("druid.username",props.getProperty("lisusername")); - properties.setProperty("druid.password",props.getProperty("lispassword")); + properties.setProperty("druid.username",configMap.get("lisusername")); + properties.setProperty("druid.password",configMap.get("lispassword")); dataSource.restart(properties); log.info("鏁版嵁搴撹繛鎺ユ垚鍔�!!!"); } catch (Exception e) { - log.info("鏁版嵁搴撹繛鎺ュけ璐� 璇疯仈绯荤鐞嗗憳锛�"); + log.error("鏁版嵁搴撹繛鎺ュけ璐� 璇疯仈绯荤鐞嗗憳锛�"); e.printStackTrace(); } return druidProperties.dataSource(dataSource); @@ -181,25 +111,16 @@ // @ConditionalOnProperty(prefix = "spring.datasource.druid.slavepacs", name = "enabled", havingValue = "true") public DataSource slaveDataPacsSource(DruidProperties druidProperties) { DruidDataSource dataSource = DruidDataSourceBuilder.create().build(); - Properties props = new Properties(); + Map<String, String> configMap = configValue.getConfigMap(); try { - // 浠庢枃浠朵腑璇诲彇閰嶇疆淇℃伅 - FileInputStream fis = null; - try { - fis = new FileInputStream(CONFIG_PATH); - } catch (FileNotFoundException e) { - log.info("鏁版嵁搴撹繛鎺ユ枃浠舵壘涓嶅埌"); - } - props.load(fis); - fis.close(); // 鑾峰彇灞炴�у�煎苟璧嬪�� Properties properties = new Properties(); // 杩欓噷鏄祴璇曞啓娉曪紝鍏蜂綋鐨剉alue鍙互閫氳繃璇锋眰鍙傛暟浼犻�掕繃鏉� - properties.setProperty("druid.enabled",props.getProperty("pacsenabled")); + properties.setProperty("druid.enabled",configMap.get("pacsenabled")); properties.setProperty("druid.driverClassName","oracle.jdbc.OracleDriver"); - properties.setProperty("druid.url","jdbc:oracle:thin:@//"+props.getProperty("pacsip")+"/"+props.getProperty("pacsname")); - properties.setProperty("druid.username",props.getProperty("pacsusername")); - properties.setProperty("druid.password",props.getProperty("pacspassword")); + properties.setProperty("druid.url","jdbc:oracle:thin:@//"+configMap.get("pacsip")+"/"+configMap.get("pacsname")); + properties.setProperty("druid.username",configMap.get("pacsusername")); + properties.setProperty("druid.password",configMap.get("pacspassword")); dataSource.restart(properties); log.info("鏁版嵁搴撹繛鎺ユ垚鍔�!!!"); } catch (Exception e) { diff --git a/src/main/java/com/example/config/RedisConfig.java b/src/main/java/com/example/config/RedisConfig.java index cc503cd..097d26f 100644 --- a/src/main/java/com/example/config/RedisConfig.java +++ b/src/main/java/com/example/config/RedisConfig.java @@ -2,6 +2,7 @@ import com.example.utils.FastJson2JsonRedisSerializer; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.cache.annotation.CachingConfigurerSupport; import org.springframework.cache.annotation.EnableCaching; @@ -15,6 +16,7 @@ import redis.clients.jedis.JedisPoolConfig; import java.io.*; +import java.util.Map; import java.util.Properties; /** @@ -27,15 +29,13 @@ @Slf4j public class RedisConfig extends CachingConfigurerSupport { - @Value ("${config.path}") - private String url; - - @Value ("${config.dir}") - private String path; + @Autowired + private ConfigValue configValue; @Bean @SuppressWarnings(value = {"unchecked", "rawtypes"}) public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory connectionFactory) { + log.info("Initializing RedisTemplate..."); RedisTemplate<Object, Object> template = new RedisTemplate<>(); template.setConnectionFactory(connectionFactory); @@ -50,6 +50,7 @@ template.setHashValueSerializer(serializer); template.afterPropertiesSet(); + log.info("RedisTemplate initialized"); return template; } @@ -68,81 +69,20 @@ @Bean public RedisConnectionFactory redisConnectionFactory(JedisPoolConfig jedisPoolConfig) { JedisConnectionFactory factory = new JedisConnectionFactory(); + Map<String, String> configMap = configValue.getConfigMap(); // 浠庢枃浠朵腑璇诲彇閰嶇疆淇℃伅 - try { - FileInputStream fis = null; - Properties props = new Properties(); - try { - fis = new FileInputStream(url); - } catch (FileNotFoundException e) { - log.info("閰嶇疆鏂囦欢鎵句笉鍒� 绯荤粺姝e湪鍒涘缓锛�"); - File f = new File(path); - if(!f.exists()){ - f.mkdirs(); - } - File file = new File(url); - try { - FileWriter fileWriter = new FileWriter(file); - fileWriter.write("ip = 浣犵殑涓绘暟鎹簱杩炴帴ip鍦板潃\n"); - fileWriter.write("prot = 浣犵殑涓绘暟鎹簱杩炴帴绔彛\n"); - fileWriter.write("name = 浣犵殑涓绘暟鎹簱杩炴帴鍚嶇О\n"); - fileWriter.write("username = 浣犵殑涓绘暟鎹簱杩炴帴鐢ㄦ埛鍚峔n"); - fileWriter.write("password = 浣犵殑涓绘暟鎹簱杩炴帴瀵嗙爜\n"); - fileWriter.write("hisenabled = 鏄惁寮�鍚� his 浠庡簱鏁版嵁搴撹繛鎺� (浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴 fales)\n"); - fileWriter.write("\n"); - - fileWriter.write("hisip = 浣犵殑 his 鏁版嵁搴撹繛鎺p鍦板潃\n"); - fileWriter.write("hisprot = 浣犵殑 his 鏁版嵁搴撹繛鎺ョ鍙n"); - fileWriter.write("hisname = 浣犵殑 his 鏁版嵁搴撹繛鎺ュ悕绉癨n"); - fileWriter.write("hisusername = 浣犵殑 his 鏁版嵁搴撹繛鎺ョ敤鎴峰悕\n"); - fileWriter.write("hispassword = 浣犵殑 his 鏁版嵁搴撹繛鎺ュ瘑鐮乗n"); - fileWriter.write("\n"); - - fileWriter.write("pacsenabled = 鏄惁寮�鍚痯acs浠庡簱鏁版嵁搴撹繛鎺� (浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴 fales)\n"); - fileWriter.write("pacsip = 浣犵殑pacs鏁版嵁搴撹繛鎺p鍦板潃\n"); - fileWriter.write("pacsprot = 浣犵殑pacs鏁版嵁搴撹繛鎺ョ鍙n"); - fileWriter.write("pacsname = 浣犵殑pacs鏁版嵁搴撹繛鎺ュ悕绉癨n"); - fileWriter.write("pacsusername = 浣犵殑pacs鏁版嵁搴撹繛鎺ョ敤鎴峰悕\n"); - fileWriter.write("pacspassword = 浣犵殑pacs鏁版嵁搴撹繛鎺ュ瘑鐮乗n"); - fileWriter.write("\n"); - - fileWriter.write("lisenabled = 鏄惁寮�鍚� lis 浠庡簱鏁版嵁搴撹繛鎺� (浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴 fales)\n"); - fileWriter.write("lisip = 浣犵殑 lis 鏁版嵁搴撹繛鎺p鍦板潃\n"); - fileWriter.write("lisprot = 浣犵殑 lis 鏁版嵁搴撹繛鎺ョ鍙n"); - fileWriter.write("lisname = 浣犵殑 lis 鏁版嵁搴撹繛鎺ュ悕绉癨n"); - fileWriter.write("lisusername = 浣犵殑 lis 鏁版嵁搴撹繛鎺ョ敤鎴峰悕\n"); - fileWriter.write("lispassword = 浣犵殑 lis 鏁版嵁搴撹繛鎺ュ瘑鐮乗n"); - fileWriter.write("redisIp = 浣犵殑redisIp鍦板潃\n"); - fileWriter.write("redisProt = 浣犵殑redis绔彛\n"); - fileWriter.write("redisIpDatabase = 浣犵殑redis閾炬帴搴揬n"); - fileWriter.write("redisPassword = 浣犵殑redis瀵嗙爜\n"); - fileWriter.write("\n"); - fileWriter.close(); - log.info("閰嶇疆鏂囦欢鍒涘缓鎴愬姛锛�"); - } catch (IOException ioException) { - log.info("閰嶇疆鏂囦欢鍒涘缓澶辫触 璇疯仈绯荤鐞嗗憳鎵嬪姩鍒涘缓锛�"); - ioException.printStackTrace(); - } - e.printStackTrace(); - } - props.load(fis); - fis.close(); - // 鑾峰彇灞炴�у�煎苟璧嬪�� - factory.setPoolConfig(jedisPoolConfig); - // 璁剧疆Redis鏈嶅姟鍣ㄧ殑鍦板潃鍜岀鍙e彿 - factory.setHostName(props.getProperty("redisIp")); - factory.setPort(Integer.parseInt(props.getProperty("redisProt"))); - // 濡傛灉闇�瑕佸瘑鐮侀獙璇侊紝璁剧疆瀵嗙爜 - factory.setPassword(props.getProperty("redisPassword")); - // 璁剧疆鍏朵粬鍙傛暟锛屽鏁版嵁搴撶储寮曠瓑 - factory.setDatabase(Integer.parseInt(props.getProperty("redisIpDatabase"))); - // 鏈�鍚庯紝鍒濆鍖栬繛鎺� - factory.afterPropertiesSet(); - log.info("redis杩炴帴鎴愬姛!!!"); - } catch (IOException e) { - log.info("redis杩炴帴澶辫触 璇疯仈绯荤鐞嗗憳锛�"); - e.printStackTrace(); - } + // 鑾峰彇灞炴�у�煎苟璧嬪�� + factory.setPoolConfig(jedisPoolConfig); + // 璁剧疆Redis鏈嶅姟鍣ㄧ殑鍦板潃鍜岀鍙e彿 + factory.setHostName(configMap.get("redisIp")); + factory.setPort(Integer.parseInt(configMap.get("redisProt"))); + // 濡傛灉闇�瑕佸瘑鐮侀獙璇侊紝璁剧疆瀵嗙爜 + factory.setPassword(configMap.get("redisPassword")); + // 璁剧疆鍏朵粬鍙傛暟锛屽鏁版嵁搴撶储寮曠瓑 + factory.setDatabase(Integer.parseInt(configMap.get("redisIpDatabase"))); + // 鏈�鍚庯紝鍒濆鍖栬繛鎺� + factory.afterPropertiesSet(); + log.info("redis杩炴帴鎴愬姛!!!"); return factory; } diff --git a/src/main/java/com/example/controller/HisController.java b/src/main/java/com/example/controller/HisController.java new file mode 100644 index 0000000..978e21f --- /dev/null +++ b/src/main/java/com/example/controller/HisController.java @@ -0,0 +1,274 @@ +package com.example.controller; + +import com.example.domain.TjCustomer; +import com.example.dto.xian.meiji.CheXiaoMzFyDto; +import com.example.dto.xian.meiji.CreateMenZhenFyDto; +import com.example.factory.ServiceFactory; +import com.example.service.HisService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * his鎺ュ彛璇锋眰 + * @Company: 瑗垮畨璺嘲绉戞妧鏈夐檺鍏徃 + * @Author: zhaowenxuan + * @Date: 2024/12/17 17:16 + */ +@RestController +@RequestMapping("/api/his") +public class HisController { + + private final ServiceFactory serviceFactory; + private final HisService hisService; + + @Autowired + public HisController(ServiceFactory serviceFactory) { + this.serviceFactory = serviceFactory; + hisService= serviceFactory.getService(); + } + + + /** + * 寤烘。 + * @param customer + * @return + */ + @PostMapping("creat") + public String jianDang (TjCustomer customer) { + return hisService.jianDang(customer); + } + + /** + * 楠岃瘉韬唤璇佹槸鍚﹀缓杩囨。 + * @param customer + * @return + */ + @PostMapping("isCreat") + public String getBingRenXxByShengFenZheng (TjCustomer customer) { + return hisService.getBingRenXxByShengFenZheng(customer); + } + + /** + * 鐥呬汉鍩烘湰淇℃伅鍙樻洿 + * @param customer + * @return + */ + @PostMapping("update") + public String saveBingRenXx (TjCustomer customer) { + return hisService.saveBingRenXx(customer); + } + + /** + * 寰呮敹璐硅垂鐢ㄦ煡璇� + * @param bingRenId + * @param jiuZhenKh + * @param yuanQuId + * @return + */ + @PostMapping("getPendingPaymentList") + public String getListDaiShouFei (String bingRenId,String jiuZhenKh,String yuanQuId) { + return hisService.getListDaiShouFei(bingRenId,jiuZhenKh,yuanQuId); + } + + + /** + * 鐢熸垚寰呮敹璐�/寰呴��璐� 璐圭敤 + * @param dto + * @return + */ + @PostMapping("creatCostInfo") + public String createMenZhenFy (CreateMenZhenFyDto dto) { + return hisService.createMenZhenFy(dto); + } + + + /** + * 闂ㄨ瘖鏈敹璐硅垂鐢ㄦ挙閿� + * @param dto + * @return + */ + @PostMapping("revokeCost") + public String cheXiaoMzFy (CheXiaoMzFyDto dto) { + return hisService.cheXiaoMzFy(dto); + } + + + /** + * 鏀惰垂/閫�璐瑰畬鎴愰�氱煡绗笁鏂� + * @param feiYongId + * @param yeWuLx + * @return + */ + @PostMapping("pushPayMsg") + public String pushZhiFuMsg (String feiYongId,int yeWuLx ) { + return hisService.pushZhiFuMsg(feiYongId,yeWuLx); + } + + + /** + * 绉戝淇℃伅鏌ヨ + * @param yuanQuId + * @param keShiMc + * @param pageIndex + * @param pageSize + * @return + */ + @PostMapping("getKeShiList") + public String getKeShi (String yuanQuId,String keShiMc,int pageIndex,int pageSize ) { + return hisService.getKeShi(yuanQuId,keShiMc,pageIndex,pageSize); + } + + /** + * 鍖荤敓淇℃伅鏌ヨ + * @param yuanQuId + * @param keShiMc + * @param pageIndex + * @param pageSize + * @return + */ + @PostMapping("getYiShengList") + public String getListYiShengZd (String yuanQuId,String keShiMc,int pageIndex,int pageSize ) { + return hisService.getListYiShengZd(yuanQuId,keShiMc,pageIndex,pageSize); + } + + + /** + * 鑾峰彇鏀惰垂椤圭洰鍒嗛〉 + * @param queryString + * @param bianGengSj + * @param pageIndex + * @param pageSize + * @return + */ + @PostMapping("getShouFeiXmList") + public String getShouFeiXm (String queryString,String bianGengSj,int pageIndex,int pageSize ) { + return hisService.getShouFeiXm(queryString,bianGengSj,pageIndex,pageSize); + } + + + + /** + *绉戝淇℃伅鎺ㄩ�� + * @param xingZhiSx 缁勭粐灞炴�� 绗竴浣�1聽琛ㄧず 鎸傚彿 + * 绗簩浣� 1琛ㄧず涓村簥 + * 绗笁浣� 1琛ㄧず妫�鏌� + * 绗洓浣� 1 琛ㄧず鎵嬫湳 + * 绗簲浣� 1 琛ㄧず娌荤枟 + * 绗叚浣� 1 琛ㄧず鎶ょ悊 + * @param queryString 妯$硦鍖归厤杈撯紛鐮�1銆佺瀹ゅ悕绉� + * @param zuoFeiBz 浣滃簾鏍囧織锛�0 姝e父锛�1 浣滃簾 + * @param yuanQuId 闄㈠尯id + * @param keShiIds 绉戝ID闆嗗悎 + * @param ifPlus 鏄惁鏌ヨplus灞炴�� + * @return + */ + @PostMapping("getKeShiByConditionsList") + public String getKeShiByConditions (int xingZhiSx, String queryString, int zuoFeiBz, String yuanQuId, List<String> keShiIds, int ifPlus) { + return hisService.getKeShiByConditions(xingZhiSx, queryString, zuoFeiBz, yuanQuId, keShiIds,ifPlus); + } + + + + /** + * 鍙栨牱鏈瓧鍏� + * @param queryString 鏍锋湰绫诲瀷鍚嶇О(鏍锋湰鍚嶇О/鏍锋湰绫诲瀷id) + * @param pageIndex + * @param pageSize 姣忊粴鏉℃暟锛堟渶饧や笉鑳借秴杩�100锛� + * @return + */ + @PostMapping("getYangBen") + public String getYangBen (String queryString,int pageIndex,int pageSize ) { + return hisService.getYangBen(queryString,pageIndex,pageSize); + } + + + /** + * 鐥呭尯淇℃伅鎺ㄩ�� + * @param yuanQuId 闄㈠尯Id + * @param keShiId 绉戝Id + * @param pageIndex 褰撳墠饣� + * @param pageSize 姣忊粴鏉℃暟锛堟渶饧や笉鑳借秴杩�100锛� + * @return + */ + @PostMapping("getBingQuList") + public String getListBingQuZd (String yuanQuId,String keShiId,int pageIndex,int pageSize ) { + return hisService.getListBingQuZd(yuanQuId,keShiId,pageIndex,pageSize); + } + + /** + * 鑱屸集淇℃伅 + * @param bianGengSj 鍙樻洿鏃堕棿 + * @param pageIndex 褰撳墠饣� + * @param pageSize 姣忊粴鏉℃暟锛堟渶饧や笉鑳借秴杩�100锛� + * @return + */ + @PostMapping("getZhiGongList") + public String getZhiGongPage (String bianGengSj,int pageIndex,int pageSize ) { + return hisService.getZhiGongPage(bianGengSj,pageIndex,pageSize); + } + + + /** + * 妫�鏌ラ」鐩� + * @param queryString + * @param bianGengSj + * @param pageIndex + * @param pageSize + * @return + */ + @PostMapping("getJcxm") + public String getJianChaXm (String queryString,String bianGengSj,int pageIndex,int pageSize ) { + return hisService.getJianChaXm(queryString,bianGengSj,pageIndex,pageSize); + } + + /** + * 妫�楠岄」饨帹閫� + * @param queryCode 鏌ヨ鐮�(椤光浆缂栫爜/鎷尖境鐮� + * @param page 褰撳墠饣� + * @param size 姣忊粴鏉℃暟锛堟渶饧や笉鑳借秴杩�100 + * @return + */ + @PostMapping("getJyxm") + public String getJianYanXm(String queryCode,Integer page,Integer size){ + return hisService.getJianYanXm(queryCode,page,size); + } + + /** + * 妫�楠岄」饨敹璐规帹閫� + * @param shouFeiXmId 鏀惰垂椤光浆id + * @param jiaGeTx 浠锋牸浣撶郴 + * @return + */ + @PostMapping("getShouFeiXmjg") + public String getShouFeiXmJg(String shouFeiXmId,String jiaGeTx){ + return hisService.getShouFeiXmJg(shouFeiXmId,jiaGeTx); + } + + /** + * 妫�楠屽鍣� + * @param queryString 瀹瑰櫒鍚嶇О(瀹瑰櫒鍚嶇О/杈撯紛鐮�1) + * @param pageIndex 褰撳墠饣� + * @param pageSize 姣忊粴鏉℃暟锛堟渶饧や笉鑳借秴杩�100锛� + * @return + */ + @PostMapping("getJyrqList") + public String getRongQi(String queryString,Integer pageIndex,Integer pageSize){ + return hisService.getRongQi(queryString,pageIndex,pageSize); + } + + /** + * 妫�楠屾牱鏈� + * @param queryString 鏍锋湰绫诲瀷鍚嶇О(鏍锋湰鍚嶇О/鏍锋湰绫诲瀷id) + * @param pageIndex 褰撳墠饣� + * @param pageSize 姣忊粴鏉℃暟锛堟渶饧や笉鑳借秴杩�100锛� + * @return + */ + @PostMapping("getJyybList") + public String getYangBen(String queryString,Integer pageIndex,Integer pageSize){ + return hisService.getJyYangBen(queryString,pageIndex,pageSize); + } +} diff --git a/src/main/java/com/example/controller/xian/MeiJiController.java b/src/main/java/com/example/controller/xian/MeiJiController.java deleted file mode 100644 index 01e1475..0000000 --- a/src/main/java/com/example/controller/xian/MeiJiController.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.example.controller.xian; - -/** - * 瑗垮畨鐓ゆ満鍖婚櫌 - * @Company: 瑗垮畨璺嘲绉戞妧鏈夐檺鍏徃 - * @Author: zhaowenxuan - * @Date: 2024/12/17 17:16 - */ -public class MeiJiController { - -} diff --git a/src/main/java/com/example/factory/ServiceFactory.java b/src/main/java/com/example/factory/ServiceFactory.java new file mode 100644 index 0000000..af49815 --- /dev/null +++ b/src/main/java/com/example/factory/ServiceFactory.java @@ -0,0 +1,44 @@ +package com.example.factory; + +import com.example.config.ConfigValue; +import com.example.service.HisService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.stereotype.Component; + +/** + * @Company: 瑗垮畨璺嘲绉戞妧鏈夐檺鍏徃 + * @Author: zhaowenxuan + * @Date: 2024/12/18 09:32 + */ +@Component +public class ServiceFactory { + private final ConfigValue configValue; + private final ApplicationContext applicationContext; + private final String userId; + + @Autowired + public ServiceFactory(ApplicationContext applicationContext, ConfigValue configValue) { + this.applicationContext = applicationContext; + this.configValue = configValue; + try { + this.userId = configValue.getConfigValue("hosp_service"); + } catch (Exception e) { + throw new RuntimeException("閰嶇疆鏂囦欢涓病鏈夐厤缃甴osp_service鍖婚櫌缂栫爜"); + } + } + + public HisService getService() { + String beanName = getServiceBeanName(userId); + return (HisService) applicationContext.getBean(beanName); + } + + private String getServiceBeanName(String userId) { + switch (userId) { + case "ShanXi_XiAn_MeiJi": + return "ShanXiXiAnMeiJi"; + default: + throw new RuntimeException("鎵句笉鍒板搴旂殑鍖婚櫌缂栫爜鏈嶅姟灞傞厤缃細" + userId); + } + } +} diff --git a/src/main/java/com/example/service/HisService.java b/src/main/java/com/example/service/HisService.java new file mode 100644 index 0000000..6ccde98 --- /dev/null +++ b/src/main/java/com/example/service/HisService.java @@ -0,0 +1,200 @@ +package com.example.service; + +import cn.hutool.json.JSONUtil; +import com.example.domain.TjCustomer; +import com.example.dto.xian.meiji.CheXiaoMzFyDto; +import com.example.dto.xian.meiji.CreateMenZhenFyDto; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @Company: 瑗垮畨璺嘲绉戞妧鏈夐檺鍏徃 + * @Author: zhaowenxuan + * @Date: 2024/12/18 09:35 + */ +@Service +public interface HisService { + /** + * 寤烘。 + * @param customer + * @return + */ + String jianDang(TjCustomer customer); + + /** + * 楠岃瘉韬唤璇佹槸鍚﹀缓杩囨。 + * @param customer + * @return + */ + String getBingRenXxByShengFenZheng(TjCustomer customer); + + /** + * 鐥呬汉鍩烘湰淇℃伅鍙樻洿 + * @param customer + * @return + */ + String saveBingRenXx(TjCustomer customer); + + /** + * 寰呮敹璐硅垂鐢ㄦ煡璇� + * @param bingRenId + * @param jiuZhenKh + * @param yuanQuId + * @return + */ + String getListDaiShouFei(String bingRenId, String jiuZhenKh, String yuanQuId); + + + /** + * 鐢熸垚寰呮敹璐�/寰呴��璐� 璐圭敤 + * @param dto + * @return + */ + String createMenZhenFy(CreateMenZhenFyDto dto); + + + /** + * 闂ㄨ瘖鏈敹璐硅垂鐢ㄦ挙閿� + * @param dto + * @return + */ + String cheXiaoMzFy(CheXiaoMzFyDto dto); + + + /** + * 鏀惰垂/閫�璐瑰畬鎴愰�氱煡绗笁鏂� + * @param feiYongId + * @param yeWuLx + * @return + */ + String pushZhiFuMsg(String feiYongId, int yeWuLx); + + + /** + * 绉戝淇℃伅鏌ヨ + * @param yuanQuId + * @param keShiMc + * @param pageIndex + * @param pageSize + * @return + */ + String getKeShi(String yuanQuId, String keShiMc, int pageIndex, int pageSize); + + /** + * 鍖荤敓淇℃伅鏌ヨ + * @param yuanQuId + * @param keShiMc + * @param pageIndex + * @param pageSize + * @return + */ + String getListYiShengZd(String yuanQuId, String keShiMc, int pageIndex, int pageSize); + + + /** + * 鑾峰彇鏀惰垂椤圭洰鍒嗛〉 + * @param queryString + * @param bianGengSj + * @param pageIndex + * @param pageSize + * @return + */ + String getShouFeiXm(String queryString, String bianGengSj, int pageIndex, int pageSize); + + + + /** + *绉戝淇℃伅鎺ㄩ�� + * @param xingZhiSx 缁勭粐灞炴�� 绗竴浣�1聽琛ㄧず 鎸傚彿 + * 绗簩浣� 1琛ㄧず涓村簥 + * 绗笁浣� 1琛ㄧず妫�鏌� + * 绗洓浣� 1 琛ㄧず鎵嬫湳 + * 绗簲浣� 1 琛ㄧず娌荤枟 + * 绗叚浣� 1 琛ㄧず鎶ょ悊 + * @param queryString 妯$硦鍖归厤杈撯紛鐮�1銆佺瀹ゅ悕绉� + * @param zuoFeiBz 浣滃簾鏍囧織锛�0 姝e父锛�1 浣滃簾 + * @param yuanQuId 闄㈠尯id + * @param keShiIds 绉戝ID闆嗗悎 + * @param ifPlus 鏄惁鏌ヨplus灞炴�� + * @return + */ + String getKeShiByConditions(int xingZhiSx, String queryString, int zuoFeiBz, String yuanQuId, List<String> keShiIds, int ifPlus); + + + + /** + * 鍙栨牱鏈瓧鍏� + * @param queryString 鏍锋湰绫诲瀷鍚嶇О(鏍锋湰鍚嶇О/鏍锋湰绫诲瀷id) + * @param pageIndex + * @param pageSize 姣忊粴鏉℃暟锛堟渶饧や笉鑳借秴杩�100锛� + * @return + */ + String getYangBen(String queryString, int pageIndex, int pageSize); + + + /** + * 鐥呭尯淇℃伅鎺ㄩ�� + * @param yuanQuId 闄㈠尯Id + * @param keShiId 绉戝Id + * @param pageIndex 褰撳墠饣� + * @param pageSize 姣忊粴鏉℃暟锛堟渶饧や笉鑳借秴杩�100锛� + * @return + */ + String getListBingQuZd(String yuanQuId, String keShiId, int pageIndex, int pageSize); + + /** + * 鑱屸集淇℃伅 + * @param bianGengSj 鍙樻洿鏃堕棿 + * @param pageIndex 褰撳墠饣� + * @param pageSize 姣忊粴鏉℃暟锛堟渶饧や笉鑳借秴杩�100锛� + * @return + */ + String getZhiGongPage(String bianGengSj, int pageIndex, int pageSize); + + + /** + * 妫�鏌ラ」鐩� + * @param queryString + * @param bianGengSj + * @param pageIndex + * @param pageSize + * @return + */ + String getJianChaXm(String queryString, String bianGengSj, int pageIndex, int pageSize); + + /** + * 妫�楠岄」饨帹閫� + * @param queryCode 鏌ヨ鐮�(椤光浆缂栫爜/鎷尖境鐮� + * @param page 褰撳墠饣� + * @param size 姣忊粴鏉℃暟锛堟渶饧や笉鑳借秴杩�100 + * @return + */ + String getJianYanXm(String queryCode, Integer page, Integer size); + + /** + * 妫�楠岄」饨敹璐规帹閫� + * @param shouFeiXmId 鏀惰垂椤光浆id + * @param jiaGeTx 浠锋牸浣撶郴 + * @return + */ + String getShouFeiXmJg(String shouFeiXmId, String jiaGeTx); + + /** + * 妫�楠屽鍣� + * @param queryString 瀹瑰櫒鍚嶇О(瀹瑰櫒鍚嶇О/杈撯紛鐮�1) + * @param pageIndex 褰撳墠饣� + * @param pageSize 姣忊粴鏉℃暟锛堟渶饧や笉鑳借秴杩�100锛� + * @return + */ + String getRongQi(String queryString, Integer pageIndex, Integer pageSize); + + /** + * 妫�楠屾牱鏈� + * @param queryString 鏍锋湰绫诲瀷鍚嶇О(鏍锋湰鍚嶇О/鏍锋湰绫诲瀷id) + * @param pageIndex 褰撳墠饣� + * @param pageSize 姣忊粴鏉℃暟锛堟渶饧や笉鑳借秴杩�100锛� + * @return + */ + String getJyYangBen(String queryString, Integer pageIndex, Integer pageSize); +} diff --git a/src/main/java/com/example/service/xian/MeiJiService.java b/src/main/java/com/example/service/xian/MeiJiHisService.java similarity index 63% rename from src/main/java/com/example/service/xian/MeiJiService.java rename to src/main/java/com/example/service/xian/MeiJiHisService.java index ff35c05..6036418 100644 --- a/src/main/java/com/example/service/xian/MeiJiService.java +++ b/src/main/java/com/example/service/xian/MeiJiHisService.java @@ -2,17 +2,21 @@ import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; -import cn.hutool.json.JSON; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; +import com.example.config.ConfigValue; import com.example.domain.TjCustomer; import com.example.dto.xian.meiji.CheXiaoMzFyDto; import com.example.dto.xian.meiji.CreateMenZhenFyDto; +import com.example.service.HisService; import com.example.service.ISysConfigService; import com.example.utils.HttpClientUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.ApplicationContext; import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Service; import java.io.FileInputStream; import java.io.IOException; @@ -28,67 +32,50 @@ * @Author: zhaowenxuan * @Date: 2024/12/17 17:17 */ -public class MeiJiService { - @Autowired - private ISysConfigService configService; - @Autowired - private RedisTemplate<String ,Object> redisTemplate; - - private static String HIS_URL = "http://oapi.pbkwyy.com/OAPI"; - - private static String CONFIG_PATH; - - private static String GRANT_TYPE = "client_credentials"; - private static String CLIENT_ID = "XFZZQEfXTZ7exhhi"; - private static String CLIENT_SECRET = "05a192176c21edfcc9cf5fa26fc5a9e0c5b131ad"; -// private static String SCOP = ""; - +@Service("ShanXiXiAnMeiJi") +public class MeiJiHisService implements HisService { // http://oapi.pbkwyy.com/OAPI/oauth/token // grant_type:client_credentials // client_id:XFZZQEfXTZ7exhhi // client_secret:05a192176c21edfcc9cf5fa26fc5a9e0c5b131ad +// http://oapi.pbkwyy.com/OAPI - @Value("${config.properties}") - public void setConfigPath(String configPath) { - CONFIG_PATH = configPath; - try { - FileInputStream inputStream = new FileInputStream(CONFIG_PATH); - Properties props = new Properties(); - props.load(inputStream); - String url = props.getProperty("df_his_api_url"); - String port = props.getProperty("df_his_api_port"); - GRANT_TYPE = props.getProperty("grant_type"); - CLIENT_ID= props.getProperty("client_id"); - CLIENT_SECRET = props.getProperty("client_secret"); -// SCOP = props.getProperty("scope"); - HIS_URL=url+":"+port+"/OAPI/"; - } catch (IOException throwables) { - throwables.printStackTrace(); - } + @Autowired + public MeiJiHisService(ApplicationContext applicationContext, ConfigValue configValue) { + this.applicationContext = applicationContext; + this.configValue = configValue; + HIS_URL = configValue.getConfigValue("his_api_url") + ":" + configValue.getConfigValue("his_api_port") +"/OAPI/"; } + @Autowired + private ISysConfigService configService; + + @Autowired + private RedisTemplate<Object ,Object> redisTemplate; + + private ConfigValue configValue; + private final ApplicationContext applicationContext; + + private final String HIS_URL; //鑾峰彇token private JSONObject getToken () { + String GRANT_TYPE = "client_credentials"; + String CLIENT_ID = "XFZZQEfXTZ7exhhi"; + String CLIENT_SECRET = "05a192176c21edfcc9cf5fa26fc5a9e0c5b131ad"; + Map<String, Object> map = new HashMap<>(); - map.put("grant_type",GRANT_TYPE); - map.put("client_id",CLIENT_ID); - map.put("client_secret",CLIENT_SECRET); + map.put("grant_type", GRANT_TYPE); + map.put("client_id", CLIENT_ID); + map.put("client_secret", CLIENT_SECRET); // map.put("scope",SCOP); String post = sendPost (HIS_URL+"/oauth/token", map); if (StrUtil.isBlank(post)) return null; - JSONObject parseObj = JSONUtil.parseObj(post); -// Integer expiresIn = parseObj.getInt("expires_in"); -// if (expiresIn != null){ -// parseObj.putOpt("time",Instant.now().getEpochSecond()); -// redisTemplate.opsForHash().putAll("token:his:df",parseObj); -// redisTemplate.expire("token:his:df",expiresIn - 10, TimeUnit.SECONDS); -// } - return parseObj; + return JSONUtil.parseObj(post); } //寤烘。 - public JSON jianDang (TjCustomer customer) { + public String jianDang (TjCustomer customer) { String czy = configService.selectConfigByKey("dfhisczybm"); Map<String, Object> map = new HashMap<> (); @@ -124,24 +111,22 @@ map.put ("minZuDm",""); map.put ("minZuMc",""); //鑱屼笟缂栫爜 - String post = sendPost (HIS_URL+"/menZhenJz/jianDang", map); - return JSONUtil.parseObj(post); + return sendPost (HIS_URL+"/menZhenJz/jianDang", map); } //楠岃瘉韬唤璇佹槸鍚﹀缓杩囨。 - public JSON getBingRenXxByShengFenZheng (TjCustomer customer) { + public String getBingRenXxByShengFenZheng (TjCustomer customer) { String czy = configService.selectConfigByKey("dfhisczybm"); Map<String, Object> map = new HashMap<> (); map.put ("caoZuoYuan",czy); map.put ("shenFenZh", customer.getCusIdcard ()); map.put ("danWeiBh",""); //鑱屼笟缂栫爜 - String post = sendPost (HIS_URL+"/menZhenJz/getBingRenXxByShengFenZheng", map); - return JSONUtil.parseObj(post); + return sendPost (HIS_URL+"/menZhenJz/getBingRenXxByShengFenZheng", map); } //鐥呬汉鍩烘湰淇℃伅鍙樻洿 - public JSON saveBingRenXx (TjCustomer customer) { + public String saveBingRenXx (TjCustomer customer) { String czy = configService.selectConfigByKey("dfhisczybm"); Map<String, Object> map = new HashMap<> (); map.put ("jiuZhenKh", customer.getPationId ()); @@ -165,24 +150,22 @@ map.put ("jiLuLy","3"); map.put ("caoZuoYuan",czy); //鑱屼笟缂栫爜 - String post = sendPost (HIS_URL+"/menZhenJz/saveBingRenXx", map); - return JSONUtil.parseObj(post); + return sendPost (HIS_URL+"/menZhenJz/saveBingRenXx", map); } //寰呮敹璐硅垂鐢ㄦ煡璇� - public JSON getListDaiShouFei (String bingRenId,String jiuZhenKh,String yuanQuId) { + public String getListDaiShouFei (String bingRenId, String jiuZhenKh, String yuanQuId) { Map<String, Object> map = new HashMap<> (); map.put ("bingRenId",bingRenId); map.put ("jiuZhenKh",jiuZhenKh); map.put ("yuanQuId",yuanQuId); //鑱屼笟缂栫爜 - String post = sendPost (HIS_URL+"/shouFei/getListDaiShouFei", map); - return JSONUtil.parseObj(post); + return sendPost (HIS_URL+"/shouFei/getListDaiShouFei", map); } //鐢熸垚寰呮敹璐�/寰呴��璐� 璐圭敤 - public JSON createMenZhenFy (CreateMenZhenFyDto dto) { + public String createMenZhenFy (CreateMenZhenFyDto dto) { String czy = configService.selectConfigByKey("dfhisczybm"); Map<String, Object> map = new HashMap<> (); map.put ("bingRenId",dto.getBingRenId()); @@ -195,48 +178,44 @@ map.put ("shouTuiBz",dto.getShouTuiBz()); map.put ("feiYongMxList",dto.getFeiYongMxList()); //鑱屼笟缂栫爜 - String post = sendPost (HIS_URL+"/shouFei/createMenZhenFy", map); - return JSONUtil.parseObj(post); + return sendPost (HIS_URL+"/shouFei/createMenZhenFy", map); } //闂ㄨ瘖鏈敹璐硅垂鐢ㄦ挙閿� - public JSON cheXiaoMzFy (CheXiaoMzFyDto dto) { + public String cheXiaoMzFy (CheXiaoMzFyDto dto) { Map<String, Object> map = new HashMap<> (); map.put ("bingRenId",dto.getBingRenId()); map.put ("jiuZhenKh",dto.getJiuZhenKh()); map.put ("feiYongIdList",dto.getFeiYongIdList()); //鑱屼笟缂栫爜 - String post = sendPost (HIS_URL+"/shouFei/cheXiaoMzFy", map); - return JSONUtil.parseObj(post); + return sendPost (HIS_URL+"/shouFei/cheXiaoMzFy", map); } //鏀惰垂/閫�璐瑰畬鎴愰�氱煡绗笁鏂� - public JSON pushZhiFuMsg (String feiYongId,int yeWuLx ) { + public String pushZhiFuMsg (String feiYongId, int yeWuLx ) { Map<String, Object> map = new HashMap<> (); map.put ("feiYongId",feiYongId); map.put ("yeWuLx",yeWuLx); //鑱屼笟缂栫爜 - String post = sendPost (HIS_URL+"/shouFei/pushZhiFuMsg", map); - return JSONUtil.parseObj(post); + return sendPost (HIS_URL+"/shouFei/pushZhiFuMsg", map); } //绉戝淇℃伅鏌ヨ - public JSON getKeShi (String yuanQuId,String keShiMc,int pageIndex,int pageSize ) { + public String getKeShi (String yuanQuId, String keShiMc, int pageIndex, int pageSize ) { Map<String, Object> map = new HashMap<> (); map.put ("yuanQuId",yuanQuId); map.put ("keShiMc",keShiMc); map.put ("pageIndex",pageIndex); map.put ("pageSize",pageSize); //鑱屼笟缂栫爜 - String post = sendPost (HIS_URL+"/zhuShuJu/getKeShi", map); - return JSONUtil.parseObj(post); + return sendPost (HIS_URL+"/zhuShuJu/getKeShi", map); } //鍖荤敓淇℃伅鏌ヨ - public JSON getListYiShengZd (String yuanQuId,String keShiMc,int pageIndex,int pageSize ) { + public String getListYiShengZd (String yuanQuId, String keShiMc, int pageIndex, int pageSize ) { Map<String, Object> map = new HashMap<> (); map.put ("yuanQuId",yuanQuId); map.put ("keShiMc",keShiMc); @@ -244,41 +223,40 @@ map.put ("pageIndex",pageIndex); map.put ("pageSize",pageSize); //鑱屼笟缂栫爜 - String post = sendPost (HIS_URL+"/zhuShuJu/getListYiShengZd", map); - return JSONUtil.parseObj(post); + return sendPost (HIS_URL+"/zhuShuJu/getListYiShengZd", map); } //鑾峰彇鏀惰垂椤圭洰鍒嗛〉 - public JSON getShouFeiXm (String queryString,String bianGengSj,int pageIndex,int pageSize ) { + public String getShouFeiXm (String queryString, String bianGengSj, int pageIndex, int pageSize ) { Map<String, Object> map = new HashMap<> (); map.put ("queryString",queryString); map.put ("bianGengSj",bianGengSj); map.put ("pageIndex",pageIndex); map.put ("pageSize",pageSize); //鑱屼笟缂栫爜 - String post = sendPost (HIS_URL+"/zhuShuJu/getShouFeiXm", map); - return JSONUtil.parseObj(post); + return sendPost (HIS_URL+"/zhuShuJu/getShouFeiXm", map); } /** - *绉戝淇℃伅鎺ㄩ�� - * @param xingZhiSx 缁勭粐灞炴�� 绗竴浣�1聽琛ㄧず 鎸傚彿 - * 绗簩浣� 1琛ㄧず涓村簥 - * 绗笁浣� 1琛ㄧず妫�鏌� - * 绗洓浣� 1 琛ㄧず鎵嬫湳 - * 绗簲浣� 1 琛ㄧず娌荤枟 - * 绗叚浣� 1 琛ㄧず鎶ょ悊 + * 绉戝淇℃伅鎺ㄩ�� + * + * @param xingZhiSx 缁勭粐灞炴�� 绗竴浣�1聽琛ㄧず 鎸傚彿 + * 绗簩浣� 1琛ㄧず涓村簥 + * 绗笁浣� 1琛ㄧず妫�鏌� + * 绗洓浣� 1 琛ㄧず鎵嬫湳 + * 绗簲浣� 1 琛ㄧず娌荤枟 + * 绗叚浣� 1 琛ㄧず鎶ょ悊 * @param queryString 妯$硦鍖归厤杈撯紛鐮�1銆佺瀹ゅ悕绉� - * @param zuoFeiBz 浣滃簾鏍囧織锛�0 姝e父锛�1 浣滃簾 - * @param yuanQuId 闄㈠尯id - * @param keShiIds 绉戝ID闆嗗悎 - * @param ifPlus 鏄惁鏌ヨplus灞炴�� + * @param zuoFeiBz 浣滃簾鏍囧織锛�0 姝e父锛�1 浣滃簾 + * @param yuanQuId 闄㈠尯id + * @param keShiIds 绉戝ID闆嗗悎 + * @param ifPlus 鏄惁鏌ヨplus灞炴�� * @return */ - public JSON getKeShiByConditions (int xingZhiSx, String queryString, int zuoFeiBz, String yuanQuId, List<String> keShiIds, int ifPlus) { + public String getKeShiByConditions (int xingZhiSx, String queryString, int zuoFeiBz, String yuanQuId, List<String> keShiIds, int ifPlus) { Map<String, Object> map = new HashMap<> (); map.put ("xingZhiSx",xingZhiSx); map.put ("queryString",queryString); @@ -287,146 +265,145 @@ map.put ("keShiIds",keShiIds); map.put ("ifPlus",ifPlus); //鑱屼笟缂栫爜 - String post = sendPost (HIS_URL+"/zhuShuJu/getKeShiByConditions", map); - return JSONUtil.parseObj(post); + return sendPost (HIS_URL+"/zhuShuJu/getKeShiByConditions", map); } /** * 鍙栨牱鏈瓧鍏� + * * @param queryString 鏍锋湰绫诲瀷鍚嶇О(鏍锋湰鍚嶇О/鏍锋湰绫诲瀷id) * @param pageIndex - * @param pageSize 姣忊粴鏉℃暟锛堟渶饧や笉鑳借秴杩�100锛� + * @param pageSize 姣忊粴鏉℃暟锛堟渶饧や笉鑳借秴杩�100锛� * @return */ - public JSON getYangBen (String queryString,int pageIndex,int pageSize ) { + public String getYangBen (String queryString, int pageIndex, int pageSize ) { Map<String, Object> map = new HashMap<> (); map.put ("queryString",queryString); map.put ("pageIndex",pageIndex); map.put ("pageSize",pageSize); //鑱屼笟缂栫爜 - String post = sendPost (HIS_URL+"/zhuShuJu/getYangBen", map); - return JSONUtil.parseObj(post); + return sendPost (HIS_URL+"/zhuShuJu/getYangBen", map); } /** - * 鐥呭尯淇℃伅鎺ㄩ�� - * @param yuanQuId 闄㈠尯Id - * @param keShiId 绉戝Id + * 鐥呭尯淇℃伅鎺ㄩ�� + * + * @param yuanQuId 闄㈠尯Id + * @param keShiId 绉戝Id * @param pageIndex 褰撳墠饣� - * @param pageSize 姣忊粴鏉℃暟锛堟渶饧や笉鑳借秴杩�100锛� + * @param pageSize 姣忊粴鏉℃暟锛堟渶饧や笉鑳借秴杩�100锛� * @return */ - public JSON getListBingQuZd (String yuanQuId,String keShiId,int pageIndex,int pageSize ) { + public String getListBingQuZd (String yuanQuId, String keShiId, int pageIndex, int pageSize ) { Map<String, Object> map = new HashMap<> (); map.put ("yuanQuId",yuanQuId); map.put ("keShiId",keShiId); map.put ("pageIndex",pageIndex); map.put ("pageSize",pageSize); //鑱屼笟缂栫爜 - String post = sendPost (HIS_URL+"/zhuShuJu/getListBingQuZd", map); - return JSONUtil.parseObj(post); + return sendPost (HIS_URL+"/zhuShuJu/getListBingQuZd", map); } /** * 鑱屸集淇℃伅 + * * @param bianGengSj 鍙樻洿鏃堕棿 - * @param pageIndex 褰撳墠饣� - * @param pageSize 姣忊粴鏉℃暟锛堟渶饧や笉鑳借秴杩�100锛� + * @param pageIndex 褰撳墠饣� + * @param pageSize 姣忊粴鏉℃暟锛堟渶饧や笉鑳借秴杩�100锛� * @return */ - public JSON getZhiGongPage (String bianGengSj,int pageIndex,int pageSize ) { + public String getZhiGongPage (String bianGengSj, int pageIndex, int pageSize ) { Map<String, Object> map = new HashMap<> (); map.put ("bianGengSj",bianGengSj); map.put ("pageIndex",pageIndex); map.put ("pageSize",pageSize); //鑱屼笟缂栫爜 - String post = sendPost (HIS_URL+"/zhuShuJu/getZhiGongPage", map); - return JSONUtil.parseObj(post); + return sendPost (HIS_URL+"/zhuShuJu/getZhiGongPage", map); } /** * 妫�鏌ラ」鐩� + * * @param queryString * @param bianGengSj * @param pageIndex * @param pageSize * @return */ - public JSON getJianChaXm (String queryString,String bianGengSj,int pageIndex,int pageSize ) { + public String getJianChaXm (String queryString, String bianGengSj, int pageIndex, int pageSize ) { Map<String, Object> map = new HashMap<> (); map.put ("queryString",queryString); map.put ("bianGengSj",bianGengSj); map.put ("pageIndex",pageIndex); map.put ("pageSize",pageSize); //鑱屼笟缂栫爜 - String post = sendPost (HIS_URL+"/zhuShuJu/getJianChaXm", map); - return JSONUtil.parseObj(post); + return sendPost (HIS_URL+"/zhuShuJu/getJianChaXm", map); } /** * 妫�楠岄」饨帹閫� + * * @param queryCode 鏌ヨ鐮�(椤光浆缂栫爜/鎷尖境鐮� - * @param page 褰撳墠饣� - * @param size 姣忊粴鏉℃暟锛堟渶饧や笉鑳借秴杩�100 + * @param page 褰撳墠饣� + * @param size 姣忊粴鏉℃暟锛堟渶饧や笉鑳借秴杩�100 * @return */ - public JSON getJianYanXm(String queryCode,Integer page,Integer size){ + public String getJianYanXm(String queryCode, Integer page, Integer size){ HashMap<String, Object> hashMap = new HashMap<>(); hashMap.put("queryCode",queryCode); hashMap.put("page",page); hashMap.put("size",size); - String post = sendPost (HIS_URL+"/zhuShuJu/getJianYanXm", hashMap); - return JSONUtil.parse(post); + return sendPost (HIS_URL+"/zhuShuJu/getJianYanXm", hashMap); } /** * 妫�楠岄」饨敹璐规帹閫� + * * @param shouFeiXmId 鏀惰垂椤光浆id - * @param jiaGeTx 浠锋牸浣撶郴 + * @param jiaGeTx 浠锋牸浣撶郴 * @return */ - public JSON getShouFeiXmJg(String shouFeiXmId,String jiaGeTx){ + public String getShouFeiXmJg(String shouFeiXmId, String jiaGeTx){ HashMap<String, Object> hashMap = new HashMap<>(); hashMap.put("shouFeiXmId",shouFeiXmId); hashMap.put("jiaGeTx",jiaGeTx); - String post = sendPost (HIS_URL+"/zhuShuJu/getShouFeiXmJg", hashMap); - return JSONUtil.parse(post); + return sendPost (HIS_URL+"/zhuShuJu/getShouFeiXmJg", hashMap); } /** * 妫�楠屽鍣� + * * @param queryString 瀹瑰櫒鍚嶇О(瀹瑰櫒鍚嶇О/杈撯紛鐮�1) - * @param pageIndex 褰撳墠饣� - * @param pageSize 姣忊粴鏉℃暟锛堟渶饧や笉鑳借秴杩�100锛� + * @param pageIndex 褰撳墠饣� + * @param pageSize 姣忊粴鏉℃暟锛堟渶饧や笉鑳借秴杩�100锛� * @return */ - public JSON getRongQi(String queryString,Integer pageIndex,Integer pageSize){ + public String getRongQi(String queryString, Integer pageIndex, Integer pageSize){ HashMap<String, Object> hashMap = new HashMap<>(); hashMap.put("queryString",queryString); hashMap.put("pageIndex",pageIndex); hashMap.put("pageSize",pageSize); - String post = sendPost (HIS_URL+"/zhuShuJu/getRongQi", hashMap); - return JSONUtil.parse(post); + return sendPost (HIS_URL+"/zhuShuJu/getRongQi", hashMap); } /** - * 妫�楠屾牱鏈� + * 妫�楠屾牱鏈� + * * @param queryString 鏍锋湰绫诲瀷鍚嶇О(鏍锋湰鍚嶇О/鏍锋湰绫诲瀷id) - * @param pageIndex 褰撳墠饣� - * @param pageSize 姣忊粴鏉℃暟锛堟渶饧や笉鑳借秴杩�100锛� + * @param pageIndex 褰撳墠饣� + * @param pageSize 姣忊粴鏉℃暟锛堟渶饧や笉鑳借秴杩�100锛� * @return */ - public JSON getYangBen(String queryString,Integer pageIndex,Integer pageSize){ + public String getJyYangBen(String queryString, Integer pageIndex, Integer pageSize){ HashMap<String, Object> hashMap = new HashMap<>(); hashMap.put("queryString",queryString); hashMap.put("pageIndex",pageIndex); hashMap.put("pageSize",pageSize); - String post = sendPost (HIS_URL+"/zhuShuJu/getYangBen", hashMap); - return JSONUtil.parse(post); + return sendPost (HIS_URL+"/zhuShuJu/getYangBen", hashMap); } private String sendPost(String url,Map<String, Object> hashMap){ -- Gitblit v1.8.0