Ver código fonte

drgapi配置

xiaochan 3 meses atrás
pai
commit
a680c274af

+ 1 - 1
pom.xml

@@ -10,7 +10,7 @@
     </parent>
     <groupId>thyyxxk</groupId>
     <artifactId>web-server</artifactId>
-    <version>13.1.1</version>
+    <version>13.1.2</version>
     <name>web-server</name>
     <description>server for yibao-web</description>
     <properties>

+ 16 - 0
src/main/java/thyyxxk/webserver/config/envionment/SystemConfig.java

@@ -15,4 +15,20 @@ public class SystemConfig {
      * 合理用药
      */
     private String rationalUseUrl;
+
+
+    /**
+     * 医院名称
+     */
+    private String institutionName;
+
+    /**
+     * 医院编码
+     */
+    private String institutionId;
+
+    /**
+     * 机构领域
+     */
+    private String institutionArea;
 }

+ 79 - 7
src/main/java/thyyxxk/webserver/http/drg/DrgWebApi.java

@@ -1,19 +1,25 @@
 package thyyxxk.webserver.http.drg;
 
 import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.dtflys.forest.Forest;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import thyyxxk.webserver.config.envionment.ApiUrl;
+import thyyxxk.webserver.config.envionment.SystemConfig;
+import thyyxxk.webserver.config.exception.ExceptionEnum;
+import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.vo.DrgGroupTestVO;
+import thyyxxk.webserver.utils.ResultVoUtil;
 
 @Service
+@RequiredArgsConstructor
+@Slf4j
 public class DrgWebApi {
     private final ApiUrl apiUrl;
-
-    public DrgWebApi(ApiUrl apiUrl) {
-        this.apiUrl = apiUrl;
-    }
+    private final SystemConfig config;
 
     public String localHelpDrgDagns(DrgGroupTestVO drgGroupTestVO) {
         if (StrUtil.isBlank(apiUrl.getDrgWebApi())) {
@@ -30,8 +36,7 @@ public class DrgWebApi {
         if (StrUtil.isBlank(apiUrl.getDrgWebApi())) {
             return new JSONObject();
         }
-        return
-                Forest.post(apiUrl.getDrgWebApi() + "/drg_web/drgGroupThird/V2/setListDrg.action")
+        return Forest.post(apiUrl.getDrgWebApi() + "/drg_web/drgGroupThird/V2/setListDrg.action")
                 .connectTimeout(3000)
                 .readTimeout(6000)
                 .contentTypeJson()
@@ -39,7 +44,6 @@ public class DrgWebApi {
                 .execute(JSONObject.class);
     }
 
-
     public JSONObject etlClient(JSONObject obj) {
         if (StrUtil.isBlank(apiUrl.getDrgWebApi())) {
             return new JSONObject();
@@ -66,5 +70,73 @@ public class DrgWebApi {
                 .execute(JSONObject.class);
     }
 
+    public ResultVo<JSONArray> powersiPreDischarge(String visitId) {
+        if (StrUtil.isBlank(apiUrl.getDrgWebApi())) {
+            return ResultVoUtil.success();
+        }
+        String url = apiUrl.getDrgWebApi() + "/drg_web/api/json/call.action";
+        JSONObject params = new JSONObject();
+        params.put("function_id", "apiHnsService1001");
+        params.put("hospital_id", config.getInstitutionId());
+        params.put("scene_type", "6");
+        params.put("visit_id", visitId);
+        JSONObject response;
+        try {
+            response = Forest.post(url)
+                    .contentTypeJson()
+                    .addBody(params)
+                    .execute(JSONObject.class);
+        } catch (Exception e) {
+            return ResultVoUtil.success();
+        }
+        log.info("创智出院预审:【{}】,【{}】", visitId, response);
+        if (null == response) {
+            return ResultVoUtil.success();
+        }
+        Integer retcode = response.getInteger("return_code");
+        if (null != retcode && retcode == 1) {
+            JSONArray retdata = response.getJSONArray("return_data");
+            if (null == retdata || retdata.isEmpty()) {
+                return ResultVoUtil.success();
+            }
+            return ResultVoUtil.fail(ExceptionEnum.PRE_DISCHARGE_ERROR, retdata);
+        }
+        return ResultVoUtil.success();
+    }
+
+    public ResultVo<String> frontsheetQualityCheck(JSONObject jsonParams) {
+        if (StrUtil.isBlank(apiUrl.getDrgWebApi())) {
+            return ResultVoUtil.success();
+        }
+        String url = apiUrl.getDrgWebApi() + "/drg_web/drgGroupThird/V2/groupAndQuality.action";
+        String result = Forest.post(url)
+                .contentTypeJson()
+                .addBody(jsonParams)
+                .execute(String.class);
+
+        result = apiUrl.getDrgWebApi() + result;
+        String url2 = apiUrl.getDrgWebApi() + "/drg_web/drgGroupThird/V2/drgGroupAndQuality.action";
+
+        String result2 = Forest.post(url2)
+                .contentTypeJson()
+                .addBody(jsonParams)
+                .execute(String.class);
+
+        log.info("病案质控:\n参数:{}\n结果:{}", jsonParams, result2);
+        return ResultVoUtil.success(result);
+    }
+
+    public ResultVo<String> getDrgIntelligentGrouping(JSONObject data) {
+        if (StrUtil.isBlank(apiUrl.getDrgWebApi())) {
+            return ResultVoUtil.success();
+        }
+        String url = apiUrl.getDrgWebApi() + "/drg_web/localHelp/drg_dagns/list.action";
+        String res = Forest.post(url)
+                .contentTypeJson()
+                .addBody(data)
+                .execute(String.class);
+        return ResultVoUtil.success(apiUrl.getDrgWebApi() + res);
+    }
+
 
 }

+ 1 - 1
src/main/java/thyyxxk/webserver/service/archive/ArchiveServer.java

@@ -56,7 +56,7 @@ public class ArchiveServer {
             UserCache userCache) {
         this.socketV2 = socketV2;
         this.patientArchiveDao = patientArchiveDao;
-        archiveData = archive;
+        this.archiveData = archive;
         this.userCache = userCache;
     }
 

+ 9 - 37
src/main/java/thyyxxk/webserver/service/inpatient/DismissService.java

@@ -3,6 +3,7 @@ package thyyxxk.webserver.service.inpatient;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -21,6 +22,7 @@ import thyyxxk.webserver.entity.inpatient.dismiss.*;
 import thyyxxk.webserver.entity.inpatient.patient.Overview;
 import thyyxxk.webserver.entity.inpatient.patient.Patient;
 import thyyxxk.webserver.entity.medicalinsurance.injury.InjuryCareQualification;
+import thyyxxk.webserver.http.drg.DrgWebApi;
 import thyyxxk.webserver.service.externalhttp.SiInjuryFeeUpld;
 import thyyxxk.webserver.service.externalhttp.SiZySrvc;
 import thyyxxk.webserver.utils.*;
@@ -33,11 +35,14 @@ import java.util.*;
  */
 @Slf4j
 @Service
+@RequiredArgsConstructor
 public class DismissService {
     private final DismissDao dao;
     private final SiZySrvc zySrvc;
     private final SiInjuryFeeUpld injuryFeeUpld;
     private final RestTemplate template;
+    private final DrgWebApi drgWebApi;
+
     @Value("${si-zy-fee-url}")
     private String siZyFeeUrl;
     @Value("${si-injury-fee-url}")
@@ -45,42 +50,9 @@ public class DismissService {
     @Value("${rmHkUserApi}")
     private String rmHkUserApi;
 
-    @Autowired
-    public DismissService(DismissDao dao, SiZySrvc zySrvc, SiInjuryFeeUpld injuryFeeUpld, RestTemplate template) {
-        this.dao = dao;
-        this.zySrvc = zySrvc;
-        this.injuryFeeUpld = injuryFeeUpld;
-        this.template = template;
-    }
 
     public ResultVo<JSONArray> powersiPreDischarge(String visitId) {
-        String url = "http://172.16.32.126:8080/drg_web/api/json/call.action";
-        JSONObject params = new JSONObject();
-        params.put("function_id", "apiHnsService1001");
-        params.put("hospital_id", SiUtil.INSTITUTION_ID);
-        params.put("scene_type", "6");
-        params.put("visit_id", visitId);
-
-
-        JSONObject response;
-        try {
-            response = template.postForObject(url, params, JSONObject.class);
-        } catch (Exception e) {
-            return ResultVoUtil.success();
-        }
-        log.info("创智出院预审:【{}】,【{}】", visitId, response);
-        if (null == response) {
-            return ResultVoUtil.success();
-        }
-        Integer retcode = response.getInteger("return_code");
-        if (null != retcode && retcode == 1) {
-            JSONArray retdata = response.getJSONArray("return_data");
-            if (null == retdata || retdata.isEmpty()) {
-                return ResultVoUtil.success();
-            }
-            return ResultVoUtil.fail(ExceptionEnum.PRE_DISCHARGE_ERROR, retdata);
-        }
-        return ResultVoUtil.success();
+        return drgWebApi.powersiPreDischarge(visitId);
     }
 
     public ResultVo<Object> dismiss(Patient param) {
@@ -212,7 +184,7 @@ public class DismissService {
             throw new BizException(exception);
         }
         if (param.getPsnCertType().equals(PsnCertType.RESIDENT_IDENTITY_CARD.getCode()) &&
-                !IdCardUtil.isValidatedIdCard(param.getSocialNo())) {
+            !IdCardUtil.isValidatedIdCard(param.getSocialNo())) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "身份证不合法!");
         }
         Integer age = param.getAge();
@@ -221,7 +193,7 @@ public class DismissService {
         }
         if (null != age && (age < 16 || age > 60)) {
             if (param.getName().equals(param.getContactName()) ||
-                    param.getContactRelation().equals("0")) {
+                param.getContactRelation().equals("0")) {
                 return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "16岁以下或60岁以上的患者,联系人不能填写本人。");
             }
         }
@@ -429,7 +401,7 @@ public class DismissService {
             exception.setMessage("更新住院状态失败。" + code);
             throw new BizException(exception);
         }
-        new DestructionUser(settleFee.getInpatientNo(),settleFee.getAdmissTimes()).start();
+        new DestructionUser(settleFee.getInpatientNo(), settleFee.getAdmissTimes()).start();
         return "OK";
     }
 

+ 7 - 11
src/main/java/thyyxxk/webserver/service/inpatient/casefrontsheet/CaseFrontSheetMainService.java

@@ -30,6 +30,7 @@ import thyyxxk.webserver.entity.casefrontsheet.state.State;
 import thyyxxk.webserver.entity.covid.Region;
 import thyyxxk.webserver.entity.dictionary.CodeName;
 import thyyxxk.webserver.entity.dictionary.HisWjwMatchEntity;
+import thyyxxk.webserver.http.drg.DrgWebApi;
 import thyyxxk.webserver.service.externalhttp.PowersiSrvc;
 import thyyxxk.webserver.service.zhuyuanyisheng.emr.EmrServer;
 import thyyxxk.webserver.utils.*;
@@ -49,15 +50,17 @@ public class CaseFrontSheetMainService {
     private final LoginDao userDao;
     private final PowersiSrvc srvc;
     private final EmrServer emrService;
+    private final DrgWebApi drgWebApi;
 
     public CaseFrontSheetMainService(SheetCreatedDao createdDao, CaseFrontSheetDao dao, BasSelectOverviewDao basDao,
-                                     LoginDao userDao, PowersiSrvc srvc, EmrServer emrService) {
+                                     LoginDao userDao, PowersiSrvc srvc, EmrServer emrService, DrgWebApi drgWebApi) {
         this.dao = dao;
         this.createdDao = createdDao;
         this.basDao = basDao;
         this.userDao = userDao;
         this.srvc = srvc;
         this.emrService = emrService;
+        this.drgWebApi = drgWebApi;
         if (allDictionary == null) {
             allDictionary = new ConcurrentHashMap<>();
         }
@@ -337,7 +340,7 @@ public class CaseFrontSheetMainService {
         List<CodeName> patCharges = dao.selectPatCharges(bah, times);
         for (CodeName item : patCharges) {
             String code = String.valueOf(item.getCode().charAt(0)).toUpperCase() +
-                    item.getCode().substring(1);
+                          item.getCode().substring(1);
             try {
                 Method m = sheet.getClass().getMethod("set" + code, String.class);
                 m.invoke(sheet, item.getName());
@@ -1111,7 +1114,7 @@ public class CaseFrontSheetMainService {
                     if (null == chargeSumamt || chargeSumamt < 1) {
                         String charges = entity.getWjwName().replaceAll("\\^", ",");
                         messages.add(new CodeName("surgeryTable", "患者有手术【" + entity.getName() +
-                                "】,但没有找到对应的收费项目【" + charges + "】。"));
+                                                                  "】,但没有找到对应的收费项目【" + charges + "】。"));
                     }
                 }
             }
@@ -1142,14 +1145,7 @@ public class CaseFrontSheetMainService {
         params.setDiseInfoList(FrontSheetUtil.fillDiseInfoFromSheet(sheet.getDisdiagList()));
         params.setOprtInfoList(FrontSheetUtil.fillOprtInfoFromSheet(sheet.getSurgeryList(), anstWaysMap));
         JSONObject jsonParams = JSONObject.parseObject(JSON.toJSONString(params, SerializerFeature.WriteNullStringAsEmpty));
-        String url = "http://172.16.32.126:8080/drg_web/drgGroupThird/V2/groupAndQuality.action";
-        RestTemplate template = new RestTemplate();
-        String result = template.postForObject(url, jsonParams, String.class);
-        result = "http://172.16.32.126:8080" + result;
-        String url2 = "http://172.16.32.126:8080/drg_web/drgGroupThird/V2/drgGroupAndQuality.action";
-        String result2 = template.postForObject(url2, jsonParams, String.class);
-        log.info("病案质控:\n参数:{}\n结果:{}", jsonParams, result2);
-        return ResultVoUtil.success(result);
+        return drgWebApi.frontsheetQualityCheck(jsonParams);
     }
 
     public ResultVo<String> isMedinsSetl(String patNo, Integer times) {

+ 6 - 5
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/emr/EmrServer.java

@@ -40,6 +40,7 @@ import thyyxxk.webserver.entity.zhuyuanyisheng.ZyZkList;
 import thyyxxk.webserver.entity.zhuyuanyisheng.emr.*;
 import thyyxxk.webserver.entity.zhuyuanyisheng.jianyanjiancha.YshYjReq;
 import thyyxxk.webserver.entity.zhuyuanyisheng.shoushu.OpRecord;
+import thyyxxk.webserver.http.drg.DrgWebApi;
 import thyyxxk.webserver.service.PublicServer;
 import thyyxxk.webserver.service.hutoolcache.ExtraCache;
 import thyyxxk.webserver.service.externalhttp.emr.EmrEditor;
@@ -68,6 +69,7 @@ public class EmrServer {
     private static String EMR_URL;
 
     public static final String THIS_IS_DIR = "This is Dir";
+    private final DrgWebApi drgWebApi;
 
     @Value("${forest.variables.emrUrl}")
     public void setUrl(String key) {
@@ -94,7 +96,8 @@ public class EmrServer {
                     .form("grant_type", "client_credentials").execute().body();
             JSONObject data = JSONObject.parseObject(result);
             emrToken = data.getString("access_token");
-        } catch (Exception ignored) { }
+        } catch (Exception ignored) {
+        }
     }
 
     /**
@@ -575,7 +578,7 @@ public class EmrServer {
 
         for (int i = 0; i < operation.size(); i++) {
             JSONObject item = operation.getJSONObject(i);
-            JSONArray list = null;
+            JSONArray list;
             try {
                 list = item.getJSONObject("手术名称").getJSONArray("value");
             } catch (Exception e) {
@@ -597,10 +600,8 @@ public class EmrServer {
 
         AuxiliaryFillingOfDiagnosis data = EntityCopy.Copy(mapData, AuxiliaryFillingOfDiagnosis.class);
 
-        String url = "http://172.16.32.126:8080/drg_web/localHelp/drg_dagns/list.action";
         String toJsonStr = JSON.toJSONString(data, SerializerFeature.WriteNullStringAsEmpty);
-        String res = template.postForObject(url, JSON.parseObject(toJsonStr), String.class);
-        return ResultVoUtil.success("http://172.16.32.126:8080" + res);
+        return drgWebApi.getDrgIntelligentGrouping(JSON.parseObject(toJsonStr));
     }
 
     /**

+ 3 - 0
src/main/resources/application-prod.yml

@@ -153,6 +153,9 @@ thyy:
       ignore-dis-order-role: 85
       shoushubingqu: "8000130"
     rational-use-url: http://172.16.32.121:8016/Audit.ashx
+    institution-name: "长沙泰和医院"
+    institution-id: "H43010500370"
+    institution-area: "430105"
   archive:
     path: "/mnt/archive"
     archive-url: http://172.16.32.197:20921/thyy/api/archive