Explorar o código

卫健委字典匹配模块。

lighter %!s(int64=3) %!d(string=hai) anos
pai
achega
41d4023468

+ 17 - 4
src/main/java/thyyxxk/webserver/controller/dictionary/HisWjwMatchController.java

@@ -1,9 +1,6 @@
 package thyyxxk.webserver.controller.dictionary;
 
-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.bind.annotation.*;
 import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.dictionary.HisWjwMatchEntity;
@@ -38,4 +35,20 @@ public class HisWjwMatchController {
         return ResultVoUtil.success(result);
     }
 
+    @PostMapping("/executeMatchAction")
+    public ResultVo<String> executeMatchAction(@RequestBody HisWjwMatchEntity entity) {
+        if (StringUtil.isBlank(entity.getCode())) {
+            return ResultVoUtil.fail(ExceptionEnum.INTERNAL_SERVER_ERROR, "HIS编码不能为空!");
+        }
+        if (StringUtil.isBlank(entity.getLabel())) {
+            return ResultVoUtil.fail(ExceptionEnum.INTERNAL_SERVER_ERROR, "匹配数据类别不能为空!");
+        }
+        if (entity.getLabel().equals("anaesthesia")) {
+            entity.setLabel("zd_anaesthesia");
+        } else {
+            entity.setLabel("zd_unit_code");
+        }
+        return ResultVoUtil.success(service.executeMatchAction(entity));
+    }
+
 }

+ 11 - 2
src/main/java/thyyxxk/webserver/dao/his/dictionary/HisWjwMatchDao.java

@@ -3,6 +3,7 @@ package thyyxxk.webserver.dao.his.dictionary;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
 import thyyxxk.webserver.entity.dictionary.HisWjwMatchEntity;
 
 import java.util.List;
@@ -10,9 +11,17 @@ import java.util.List;
 @Mapper
 public interface HisWjwMatchDao {
 
-    @Select("select code,name,wjw_code from ${table}")
+    @Select("<script>" +
+            "select code,name,wjw_code,py_code from ${table} " +
+            "<if test=\"table == 'zd_unit_code' \">" +
+            "where code like '1%' and isnull(del_flag,0)!=1 " +
+            "</if>" +
+            "</script>")
     List<HisWjwMatchEntity> selectHisData(@Param("table") String table);
 
-    @Select("select code,name from ${table}")
+    @Select("select code,name,py_code from ${table}")
     List<HisWjwMatchEntity> selectWjwData(@Param("table") String table);
+
+    @Update("update ${label} set wjw_code=#{wjwCode} where code=#{code}")
+    void executeMatchAction(HisWjwMatchEntity entity);
 }

+ 2 - 0
src/main/java/thyyxxk/webserver/entity/dictionary/HisWjwMatchEntity.java

@@ -7,4 +7,6 @@ public class HisWjwMatchEntity {
     private String code;
     private String name;
     private String wjwCode;
+    private String pyCode;
+    private String label;
 }

+ 11 - 0
src/main/java/thyyxxk/webserver/service/dictionary/HisWjwMatchService.java

@@ -1,14 +1,18 @@
 package thyyxxk.webserver.service.dictionary;
 
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import thyyxxk.webserver.dao.his.dictionary.HisWjwMatchDao;
 import thyyxxk.webserver.entity.dictionary.HisWjwMatchEntity;
+import thyyxxk.webserver.utils.StringUtil;
 
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+@Slf4j
 @Service
 public class HisWjwMatchService {
     private final HisWjwMatchDao dao;
@@ -34,4 +38,11 @@ public class HisWjwMatchService {
         result.put("wjwList", wjwList);
         return result;
     }
+
+    public String executeMatchAction(HisWjwMatchEntity entity) {
+        log.info("匹配卫健委字典:{}", JSONObject.toJSONString(entity));
+        dao.executeMatchAction(entity);
+        return StringUtil.isBlank(entity.getWjwCode()) ? "撤销匹配成功" : "匹配成功";
+    }
+
 }