From 74eb4efe4e23adac4e7a0b7483425243ccb63a61 Mon Sep 17 00:00:00 2001
From: zhaowenxuan <chacca165@163.com>
Date: 星期五, 18 十月 2024 16:17:47 +0800
Subject: [PATCH] 增加lis项目分类合并

---
 ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisApiGetMethodService.java    |    6 -
 ltkj-admin/src/main/java/com/ltkj/web/controller/service/TjSysAsyncServiceImpl.java |   28 +++++++++
 ltkj-hosp/src/main/resources/mapper/LisJyflhbMapper.xml                             |   19 ++++++
 ltkj-hosp/src/main/java/com/ltkj/hosp/service/LisJyflhbService.java                 |   13 ++++
 ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/LisJyflhbMapper.java                   |   18 ++++++
 ltkj-hosp/src/main/java/com/ltkj/hosp/domain/LisJyflhb.java                         |   27 +++++++++
 ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/LisJyflhbServiceImpl.java        |   22 +++++++
 7 files changed, 127 insertions(+), 6 deletions(-)

diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisApiGetMethodService.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisApiGetMethodService.java
index 6ead066..083f3d5 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisApiGetMethodService.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisApiGetMethodService.java
@@ -275,7 +275,6 @@
                 responseJson = HttpClientUtils.sendPost(LIS_URL + apiConfig.getApiUrl(), params);
                 break;
         }
-        log.info("璇锋眰杩斿洖鍊�1 ->{}",responseJson);
         Integer isResponse = apiConfig.getIsResponse();
         JSONObject response = null;
         if (isResponse == 1) {
@@ -287,10 +286,8 @@
             AjaxResult ajaxResult = AjaxResult.success();
             if (response.getStr(apiConfig.getResultDataKey()) != null && StrUtil.isNotBlank(response.getStr(apiConfig.getResultDataKey()))){
                 JSONArray resultData = response.getJSONArray(apiConfig.getResultDataKey());
-                log.info("璇锋眰杩斿洖鍊�2 ->{}",JSONUtil.toJsonStr(resultData));
                 List<Map<String, String>> list = new ArrayList<>();
                 for (Object resultDatum : resultData) {
-                    log.info("璇锋眰杩斿洖鍊�3 ->{}",JSONUtil.toJsonStr(resultDatum));
                     JSONObject object = (JSONObject) resultDatum;
                     ajaxResult = save(object, type,apiConfig,JSONUtil.toJsonStr(params));
                     Map<String, String> map = new HashMap<>();
@@ -324,7 +321,6 @@
         if (code.equals("lis") || code.equals("pacs"))
             tabName = ((ApiConfig)hisApiConfig).getTabName();
         else tabName = ((HisApiConfig) hisApiConfig).getTabName();
-        log.info("save鏂规硶 ->{}", tabName);
         Connection connection = getConnection();
         Boolean isExists = tabIsExists(connection, tabName);
         if (null == isExists)
@@ -458,7 +454,7 @@
      * @throws SQLException
      */
     @Transactional
-    private void insertDataNew(Connection connection, JSONObject jsonObject,Object hisApiConfig,String paramsJson,String code) throws SQLException {
+    public void insertDataNew(Connection connection, JSONObject jsonObject, Object hisApiConfig, String paramsJson, String code) throws SQLException {
         String tabName = "";
         List<String> primaryKesList;
         if (code.equals("lis") || code.equals("pacs")) {
diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/service/TjSysAsyncServiceImpl.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/service/TjSysAsyncServiceImpl.java
index 47729ee..78f47f3 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/controller/service/TjSysAsyncServiceImpl.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/service/TjSysAsyncServiceImpl.java
@@ -3,6 +3,7 @@
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.IdUtil;
 import cn.hutool.json.JSONArray;
 import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
@@ -147,6 +148,8 @@
     private IdUtils idUtils;
     @Autowired
     private LtkjJybbzdService jybbzdService;
+    @Autowired
+    private LisJyflhbService lisJyflhbService;
 
 
     @Override
@@ -474,7 +477,30 @@
         String config = configService.selectConfigByKey("sfkqdyhis");
         if (lisApiMethod.isUseLisAndPacsRegister(order) && (null != config && config.equals("Y"))){
             AjaxResult ajaxResult = lisApiMethod.getJyFlHb();
-            log.info("getJyFlHb ->{}",JSONUtil.toJsonStr(ajaxResult));
+            if (ajaxResult.get("code").toString().equals("200")){
+                String str = ajaxResult.get("data").toString();
+                str = str.replace("=", ":");
+                JSONArray array = JSONUtil.parseArray(str);
+                for (Object o : array) {
+                    JSONObject object = (JSONObject) o;
+                    LisJyflhb lisJyflhb = new LisJyflhb();
+                    lisJyflhb.setHbhxm(object.getStr("hbhxm"));
+                    lisJyflhb.setFlmc(object.getStr("flmc"));
+                    lisJyflhb.setMc(object.getStr("mc"));
+                    lisJyflhb.setFlbm(object.getStr("flbm"));
+                    LambdaQueryWrapper<LisJyflhb> wrapper = new LambdaQueryWrapper<>();
+                    wrapper.eq(LisJyflhb::getFlbm,lisJyflhb.getFlbm());
+                    LisJyflhb jyflhb = lisJyflhbService.getOne(wrapper);
+                    if (jyflhb == null) {
+                        lisJyflhb.setId(IdUtil.getSnowflake().nextId());
+                        lisJyflhbService.save(lisJyflhb);
+                    }else {
+                        lisJyflhb.setId(jyflhb.getId());
+                        lisJyflhbService.updateById(lisJyflhb);
+                    }
+                }
+            }
+
         }
     }
 
diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/domain/LisJyflhb.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/domain/LisJyflhb.java
new file mode 100644
index 0000000..0554c14
--- /dev/null
+++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/domain/LisJyflhb.java
@@ -0,0 +1,27 @@
+package com.ltkj.hosp.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import lombok.Data;
+
+/**
+ * @TableName lis_jyflhb
+ */
+@TableName(value ="lis_jyflhb")
+@Data
+public class LisJyflhb implements Serializable {
+    private Long id;
+
+    private String flmc;
+
+    private String mc;
+
+    private String flbm;
+
+    private String hbhxm;
+
+    private static final long serialVersionUID = 1L;
+}
\ No newline at end of file
diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/LisJyflhbMapper.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/LisJyflhbMapper.java
new file mode 100644
index 0000000..57e560b
--- /dev/null
+++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/LisJyflhbMapper.java
@@ -0,0 +1,18 @@
+package com.ltkj.hosp.mapper;
+
+import com.ltkj.hosp.domain.LisJyflhb;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+* @author w
+* @description 閽堝琛ㄣ�恖is_jyflhb銆戠殑鏁版嵁搴撴搷浣淢apper
+* @createDate 2024-10-18 15:13:39
+* @Entity com.ltkj.hosp.domain.LisJyflhb
+*/
+public interface LisJyflhbMapper extends BaseMapper<LisJyflhb> {
+
+}
+
+
+
+
diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/LisJyflhbService.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/LisJyflhbService.java
new file mode 100644
index 0000000..c43b7c4
--- /dev/null
+++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/LisJyflhbService.java
@@ -0,0 +1,13 @@
+package com.ltkj.hosp.service;
+
+import com.ltkj.hosp.domain.LisJyflhb;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+* @author w
+* @description 閽堝琛ㄣ�恖is_jyflhb銆戠殑鏁版嵁搴撴搷浣淪ervice
+* @createDate 2024-10-18 15:13:39
+*/
+public interface LisJyflhbService extends IService<LisJyflhb> {
+
+}
diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/LisJyflhbServiceImpl.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/LisJyflhbServiceImpl.java
new file mode 100644
index 0000000..3f9b366
--- /dev/null
+++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/LisJyflhbServiceImpl.java
@@ -0,0 +1,22 @@
+package com.ltkj.hosp.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ltkj.hosp.domain.LisJyflhb;
+import com.ltkj.hosp.service.LisJyflhbService;
+import com.ltkj.hosp.mapper.LisJyflhbMapper;
+import org.springframework.stereotype.Service;
+
+/**
+* @author w
+* @description 閽堝琛ㄣ�恖is_jyflhb銆戠殑鏁版嵁搴撴搷浣淪ervice瀹炵幇
+* @createDate 2024-10-18 15:13:39
+*/
+@Service
+public class LisJyflhbServiceImpl extends ServiceImpl<LisJyflhbMapper, LisJyflhb>
+    implements LisJyflhbService{
+
+}
+
+
+
+
diff --git a/ltkj-hosp/src/main/resources/mapper/LisJyflhbMapper.xml b/ltkj-hosp/src/main/resources/mapper/LisJyflhbMapper.xml
new file mode 100644
index 0000000..10a9e6b
--- /dev/null
+++ b/ltkj-hosp/src/main/resources/mapper/LisJyflhbMapper.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ltkj.hosp.mapper.LisJyflhbMapper">
+
+    <resultMap id="BaseResultMap" type="com.ltkj.hosp.domain.LisJyflhb">
+            <id property="id" column="id" jdbcType="BIGINT"/>
+            <result property="flmc" column="flmc" jdbcType="VARCHAR"/>
+            <result property="mc" column="mc" jdbcType="VARCHAR"/>
+            <result property="flbm" column="flbm" jdbcType="VARCHAR"/>
+            <result property="hbhxm" column="hbhxm" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,flmc,mc,
+        flbm,hbhxm
+    </sql>
+</mapper>

--
Gitblit v1.8.0