lighter il y a 2 ans
Parent
commit
188e969463

+ 1 - 0
src/main/java/thyyxxk/webserver/config/exception/ExceptionEnum.java

@@ -37,6 +37,7 @@ public enum ExceptionEnum {
     BAD_REQUEST(3004, "无法转换请求,请用正确的方式访问!"),
     // 以下是不需要提示的错误
     SLIGHTLY_ERROR(4001, "无需提示的返回。"),
+    PRE_DISCHARGE_ERROR(4002, "出院预审有可疑数据。"),
 
     SERVER_IS_UPDATE(5001, "服务器正在升级,请稍后在试一下。"),
 

+ 3 - 1
src/main/java/thyyxxk/webserver/controller/inpatient/DismissController.java

@@ -1,5 +1,6 @@
 package thyyxxk.webserver.controller.inpatient;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.validation.annotation.Validated;
@@ -44,8 +45,9 @@ public class DismissController {
         return service.getActOrders(inpatientNo, admissTimes);
     }
 
+    @PassToken
     @GetMapping("/powersiPreDischarge")
-    public ResultVo<JSONObject> powersiPreDischarge(@RequestParam("visitId") String visitId) {
+    public ResultVo<JSONArray> powersiPreDischarge(@RequestParam("visitId") String visitId) {
         return service.powersiPreDischarge(visitId);
     }
 

+ 14 - 2
src/main/java/thyyxxk/webserver/service/inpatient/DismissService.java

@@ -1,5 +1,6 @@
 package thyyxxk.webserver.service.inpatient;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -44,7 +45,7 @@ public class DismissService {
         this.injuryFeeUpld = injuryFeeUpld;
     }
 
-    public ResultVo<JSONObject> powersiPreDischarge(String visitId) {
+    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");
@@ -53,7 +54,18 @@ public class DismissService {
         params.put("visit_id", visitId);
         JSONObject response = new RestTemplate().postForObject(url, params, JSONObject.class);
         log.info("创智出院预审:【{}】,【{}】", visitId, response);
-        return ResultVoUtil.success(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.size() == 0) {
+                return ResultVoUtil.success();
+            }
+            return ResultVoUtil.fail(ExceptionEnum.PRE_DISCHARGE_ERROR, retdata);
+        }
+        return ResultVoUtil.success();
     }
 
     public ResultVo<Object> dismiss(Patient param) {