소스 검색

医保科室匹配

xiaochan 4 년 전
부모
커밋
98d21a7fc1

+ 48 - 0
src/main/java/thyyxxk/webserver/controller/yibaokeshipipei/YiBaoKeShiPiPeiController.java

@@ -0,0 +1,48 @@
+package thyyxxk.webserver.controller.yibaokeshipipei;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
+import thyyxxk.webserver.service.yibaokeshipipei.YiBaoKeShiPiPeiService;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 描述: 医保科室匹配目录
+ * </p>
+ *
+ * @author xc
+ * @date 2021-07-21 14:28
+ */
+@RestController
+@RequestMapping("/yiBaoKeShi")
+public class YiBaoKeShiPiPeiController {
+
+    private final YiBaoKeShiPiPeiService service;
+
+    @Autowired
+    public YiBaoKeShiPiPeiController(YiBaoKeShiPiPeiService service) {
+        this.service = service;
+    }
+
+    @GetMapping("/getBenYuanKeShi")
+    public ResultVo<List<GetDropdownBox>> getBenYuanKeShi(@RequestParam("flag") Integer flag) {
+        return service.getBenYuanKeShi(flag);
+    }
+
+    @PostMapping("/getYiBaoKeShi")
+    public ResultVo<List<GetDropdownBox>> getYiBaoKeShi() {
+        return service.getYiBaoKeShi();
+    }
+
+    @GetMapping("/piPeiKeShi")
+    public ResultVo<Integer> piPeiKeShi(@RequestParam("benYuanCode") String benYuanCode,
+                                        @RequestParam("yiBaoCode") String yiBaoCode,
+                                        @RequestParam("flag") Integer flag) {
+        return service.piPeiKeShi(benYuanCode, yiBaoCode, flag);
+    }
+
+
+}

+ 41 - 0
src/main/java/thyyxxk/webserver/dao/his/yibaokeshipipei/YibaoKeShiPiPeiDao.java

@@ -0,0 +1,41 @@
+package thyyxxk.webserver.dao.his.yibaokeshipipei;
+
+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.datamodify.GetDropdownBox;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 描述: 医保科室匹配
+ * </p>
+ *
+ * @author xc
+ * @date 2021-07-21 14:29
+ */
+@Mapper
+public interface YibaoKeShiPiPeiDao {
+
+
+    @Select("<script>" +
+            "select code,name,si_caty,(select name from t_yb_dept where code = si_caty) si_caty_name  from zd_unit_code where " +
+            "<if test=\"flag == 1\">" +
+            "si_caty is null" +
+            "</if>" +
+            "<if test=\"flag == 2\">" +
+            "si_caty is not null " +
+            "</if>" +
+            "and code not like '8%' " +
+            "</script>")
+    List<GetDropdownBox> getBenYuanKeShiCode(Integer flag);
+
+    @Select("select code,name from t_yb_dept")
+    List<GetDropdownBox> getYiBaoKeShi();
+
+    @Update("update zd_unit_code set si_caty = #{yiBaoCode} where code = #{benYuanCode}")
+    void piPeiKeShi(@Param("benYuanCode") String benYuanCode,
+                    @Param("yiBaoCode") String yiBaoCode);
+}

+ 7 - 0
src/main/java/thyyxxk/webserver/entity/datamodify/GetDropdownBox.java

@@ -1,9 +1,16 @@
 package thyyxxk.webserver.entity.datamodify;
 
+import com.fasterxml.jackson.annotation.JsonInclude;
 import lombok.Data;
 
 @Data
 public class GetDropdownBox {
     private String code;
     private String name;
+
+    @JsonInclude(JsonInclude.Include.NON_NULL)
+    private String siCaty;
+
+    @JsonInclude(JsonInclude.Include.NON_NULL)
+    private String siCatyName;
 }

+ 59 - 0
src/main/java/thyyxxk/webserver/service/yibaokeshipipei/YiBaoKeShiPiPeiService.java

@@ -0,0 +1,59 @@
+package thyyxxk.webserver.service.yibaokeshipipei;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import thyyxxk.webserver.config.exception.ExceptionEnum;
+import thyyxxk.webserver.dao.his.yibaokeshipipei.YibaoKeShiPiPeiDao;
+import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
+import thyyxxk.webserver.utils.ResultVoUtil;
+import thyyxxk.webserver.utils.TokenUtil;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 描述: 医保科室匹配
+ * </p>
+ *
+ * @author xc
+ * @date 2021-07-21 14:29
+ */
+@Service
+@Slf4j
+public class YiBaoKeShiPiPeiService {
+
+    private final YibaoKeShiPiPeiDao dao;
+
+    @Autowired
+    public YiBaoKeShiPiPeiService(YibaoKeShiPiPeiDao dao) {
+        this.dao = dao;
+    }
+
+    /**
+     * @return 获取 本院全部科室的code和name 在这里判断一下 如果 si_caty 为空的话 那就说明 是没有匹配的 切不显示 8 开头的科室
+     */
+    public ResultVo<List<GetDropdownBox>> getBenYuanKeShi(Integer flag) {
+        return ResultVoUtil.success(dao.getBenYuanKeShiCode(flag));
+    }
+
+    /**
+     * @return 返回 医保科室的 code 和 name
+     */
+    public ResultVo<List<GetDropdownBox>> getYiBaoKeShi() {
+        return ResultVoUtil.success(dao.getYiBaoKeShi());
+    }
+
+    public ResultVo<Integer> piPeiKeShi(String benYuanCode, String yiBaoCode, Integer flag) {
+        if (flag == 1) {
+            log.info("匹配医保科室编码 ==> 操作人:{},本院编码:{},医保编码:{}", TokenUtil.getTokenUserId(), benYuanCode, yiBaoCode);
+            dao.piPeiKeShi(benYuanCode, yiBaoCode);
+            return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "匹配成功。");
+        } else {
+            log.info("删除医保科室匹配关系 ==> 操作人:{},本院编码:{},医保编码:{}", TokenUtil.getTokenUserId(), benYuanCode, yiBaoCode);
+            dao.piPeiKeShi(benYuanCode, null);
+            return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "删除匹配成功。");
+        }
+    }
+}