lighter пре 4 година
родитељ
комит
b791109abf

+ 1 - 1
pom.xml

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

+ 58 - 0
src/main/java/thyyxxk/webserver/controller/powersi/PowerSiApiController.java

@@ -0,0 +1,58 @@
+package thyyxxk.webserver.controller.powersi;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.client.RestTemplate;
+import thyyxxk.webserver.config.exception.ExceptionEnum;
+import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.utils.FilterUtil;
+import thyyxxk.webserver.utils.ResultVoUtil;
+
+/**
+ * @description: 创智中台接口
+ * @author: DingJie
+ * @create: 2021-05-27 10:10:57
+ **/
+@Slf4j
+@RestController
+@RequestMapping("/powersi")
+public class PowerSiApiController {
+    @Value("${powersi-api-url}")
+    private String powersiApiUrl;
+
+    @GetMapping("/getEmpiViewUrl")
+    public ResultVo<String> getEmpiViewUrl(@RequestParam("id") String id) {
+        JSONObject param = new JSONObject();
+        param.put("de000000009", "");
+        param.put("de000000010", id);
+        RestTemplate template = new RestTemplate();
+        String url = powersiApiUrl + "/empiDataProvide/queryEmpiPatientListByIdentIndex";
+        JSONObject result = template.postForObject(url, param, JSONObject.class);
+        log.info("请求患者主索引:{}", result);
+        if (null == result) {
+            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
+        }
+        if (result.getIntValue("code") != 0) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString("msg"));
+        }
+        JSONArray data = result.getJSONArray("data");
+        if (null == data || data.size() == 0) {
+            return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "没有找到此患者的主索引。");
+        }
+        JSONObject index = data.getJSONObject(0);
+
+        String empiViewUrl = String.format("http://172.16.32.183:9002/mmg_business_thyy/business/#/360pat/patientView?" +
+                        "mainIndex=%s&patName=%s&sexName=%s&visitId=%s&tag=patientTime",
+                index.getString("de000000007"), index.getString("de020103900"),
+                FilterUtil.filterSex(index.getString("de020104000")), id);
+
+        return ResultVoUtil.success(empiViewUrl);
+    }
+
+}

+ 5 - 0
src/main/resources/META-INF/additional-spring-configuration-metadata.json

@@ -54,6 +54,11 @@
       "name": "si-api-url",
       "type": "java.lang.String",
       "description": "医保中心地址."
+    },
+    {
+      "name": "powersi-api-url",
+      "type": "java.lang.String",
+      "description": "创智中台api地址."
     }
   ]
 }