Explorar o código

门诊医保改造

lighter_217 hai 1 mes
pai
achega
b00b7ed223

+ 15 - 0
src/main/java/thyyxxk/simzfeeoprnsystm/config/HisApiConfig.java

@@ -0,0 +1,15 @@
+package thyyxxk.simzfeeoprnsystm.config;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+@Component
+@Data
+@ConfigurationProperties(prefix = "mhyy.his-api")
+@NoArgsConstructor
+public class HisApi {
+    private String zy;
+    private String mz;
+}

+ 25 - 0
src/main/java/thyyxxk/simzfeeoprnsystm/config/MedinsurConfig.java

@@ -0,0 +1,25 @@
+package thyyxxk.sizyfeeoprnsystm.config;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+@Component
+@Data
+@ConfigurationProperties(prefix = "mhyy.medinsur")
+@NoArgsConstructor
+public class MedinsurConfig {
+    private String apiUrl;
+    private String apiVersion;
+    private String apiName;
+    private String accessKey;
+    private String secretKey;
+    private String ipAddress;
+    private String macAddress;
+    private String hospId;
+    private String hospName;
+    private String hospArea;
+    private String hospLevel;
+    private String softDeveloper;
+}

+ 20 - 0
src/main/java/thyyxxk/simzfeeoprnsystm/config/RestTemplateConfig.java

@@ -0,0 +1,20 @@
+package thyyxxk.sizyfeeoprnsystm.config;
+
+import org.springframework.boot.web.client.RestTemplateBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.client.RestTemplate;
+
+import java.time.Duration;
+
+@Configuration
+public class RestTemplateConfig {
+
+    @Bean
+    public RestTemplate restTemplate(RestTemplateBuilder builder) {
+        return builder
+                .setConnectTimeout(Duration.ofSeconds(5))
+                .setReadTimeout(Duration.ofSeconds(60))
+                .build();
+    }
+}

+ 0 - 17
src/main/java/thyyxxk/simzfeeoprnsystm/dao/mariadb/MariadbDao.java

@@ -1,17 +0,0 @@
-package thyyxxk.simzfeeoprnsystm.dao.mariadb;
-
-import org.apache.ibatis.annotations.Insert;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Select;
-import thyyxxk.simzfeeoprnsystm.pojo.MzVisit;
-
-@Mapper
-public interface MariadbDao {
-
-    @Insert("insert into t_si_failed_sql (sql_content) value (#{sql}) ")
-    void insertNewRecord(String sql);
-
-    @Select("select zgmztczf from t_clinic where patient_id=#{patientId} and times=#{times} " +
-            "and receipt_no=#{receiptNo} order by receipt_no limit 1;")
-    Integer selectZgmztczf(MzVisit mzVisit);
-}

+ 0 - 25
src/main/java/thyyxxk/simzfeeoprnsystm/service/MariadbService.java

@@ -1,25 +0,0 @@
-package thyyxxk.simzfeeoprnsystm.service;
-
-import com.baomidou.dynamic.datasource.annotation.DS;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import thyyxxk.simzfeeoprnsystm.dao.mariadb.MariadbDao;
-
-@DS("thmz")
-@Slf4j
-@Service
-public class MariadbService {
-
-    private final MariadbDao dao;
-
-    @Autowired
-    public MariadbService(MariadbDao dao) {
-        this.dao = dao;
-    }
-
-    public void insertNewRecord(String sql) {
-        log.info("记录执行失败的SQL:\n{}", sql);
-        dao.insertNewRecord(sql);
-    }
-}

+ 0 - 96
src/main/java/thyyxxk/simzfeeoprnsystm/utils/SiUtil.java

@@ -1,96 +0,0 @@
-package thyyxxk.simzfeeoprnsystm.utils;
-
-import thyyxxk.simzfeeoprnsystm.dicts.SiFunction;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.codec.binary.Base64;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.env.Environment;
-import org.springframework.http.HttpHeaders;
-import org.springframework.stereotype.Component;
-
-import javax.crypto.Mac;
-import javax.crypto.spec.SecretKeySpec;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-/**
- * @description: 新医保交易工具类
- * @author: DingJie
- * @create: 2021-05-14 16:41:21
- **/
-@Component
-@Slf4j
-public class SiUtil {
-    private static int DEFAULT_SERIAL_NO = 1000;
-    private static final int MIN_SERIAL_NO = 1000;
-    private static final int MAX_SERIAL_NO = 9999;
-    public static final String INSTITUTION_AREA = "430105";
-    public static final String INSTITUTION_ID = "H43010500370";
-    public static final String INSTITUTION_NAME = "长沙泰和医院";
-    private static String apiAccessKey;
-    private static String apiSecretKey;
-
-    public static final String API_VERSION = "1.0.0";
-
-    @Autowired
-    public SiUtil(Environment environment) {
-        apiAccessKey = environment.getProperty("si-access-key");
-        apiSecretKey = environment.getProperty("si-secret-key");
-    }
-
-    public static String getInstitutionArea(String insureArea) {
-        if ("".equals(insureArea)) {
-            return INSTITUTION_AREA;
-        }
-        return insureArea.startsWith("4301") ? INSTITUTION_AREA : "439900";
-    }
-
-    private static String timestamp() {
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
-        return sdf.format(new Date());
-    }
-
-    public static synchronized String makeMsgId() {
-        DEFAULT_SERIAL_NO += 1;
-        if (DEFAULT_SERIAL_NO > MAX_SERIAL_NO) {
-            DEFAULT_SERIAL_NO = MIN_SERIAL_NO;
-        }
-        return INSTITUTION_ID + timestamp() + DEFAULT_SERIAL_NO;
-    }
-
-    public static HttpHeaders getHttpHeaders(SiFunction function) {
-        String timestamp = String.valueOf(System.currentTimeMillis());
-        String signature = getSignature(timestamp, function.getCode());
-        HttpHeaders headers = new HttpHeaders();
-        headers.add("apiAccessKey", apiAccessKey);
-        headers.add("apiSecreKey", apiSecretKey);
-        headers.add("apiName", function.getCode());
-        headers.add("apiVersion", API_VERSION);
-        headers.add("apiTimestamp", timestamp);
-        headers.add("apiSignature", signature);
-        return headers;
-    }
-
-    public static String getSignature(String timestamp, String function) {
-        String source =
-                "_api_access_key=" + apiAccessKey +
-                        "&_api_name=" + function +
-                        "&_api_timestamp=" + timestamp +
-                        "&_api_version=" + API_VERSION;
-        return hmacSha1(source);
-    }
-
-    private static String hmacSha1(String src) {
-        byte[] result = null;
-        try {
-            SecretKeySpec signInKey = new SecretKeySpec(apiSecretKey.getBytes(), "HmacSHA1");
-            Mac mac = Mac.getInstance("HmacSHA1");
-            mac.init(signInKey);
-            byte[] rawHmac = mac.doFinal(src.getBytes());
-            result = Base64.encodeBase64(rawHmac);
-        } catch (Exception e) {
-            log.error("HmacSHA1加密出错", e);
-        }
-        return null == result ? null : new String(result);
-    }
-}