From 4d1cc2fd7553f3c648da150971cd4a87c282f5ad Mon Sep 17 00:00:00 2001
From: zjh <1084500556@qq.com>
Date: 星期二, 17 十月 2023 09:06:44 +0800
Subject: [PATCH] zjh 2023/10/17--1

---
 ltkj-admin/src/main/java/com/ltkj/web/controller/system/DictHospController.java |   35 +++++++++++++++++++++++++----------
 1 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/DictHospController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/DictHospController.java
index 3ccee78..2c078de 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/DictHospController.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/DictHospController.java
@@ -4,19 +4,18 @@
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 
+import cn.hutool.extra.pinyin.PinyinUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.ltkj.common.core.domain.entity.SysDept;
+import com.ltkj.framework.config.MatchUtils;
+import com.ltkj.framework.web.domain.server.Sys;
 import com.ltkj.hosp.service.IDictOrgService;
+import com.ltkj.system.service.ISysDeptService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import com.ltkj.common.annotation.Log;
 import com.ltkj.common.core.controller.BaseController;
 import com.ltkj.common.core.domain.AjaxResult;
@@ -34,12 +33,24 @@
  */
 @RestController
 @RequestMapping("/hosp/hosp")
-@Api(tags = "鍒嗛櫌绠$悊妯″潡鎺ュ彛")
+@Api(tags = "PC绔� 鎵�灞炲尰闄㈢鐞嗘ā鍧楁帴鍙�")
 public class DictHospController extends BaseController {
     @Resource
     private IDictHospService dictHospService;
     @Resource
     private IDictOrgService orgService;
+    @Resource
+    private ISysDeptService deptService;
+
+    @GetMapping("/getDeptListByDictHospId")
+    @ApiOperation(value = "璺熷尰闄㈡煡璇㈠搴旂殑閮ㄩ棬绉戝")
+    public AjaxResult getDeptListByDictHospId(@RequestParam String id ) {
+        List<SysDept> list = deptService.list(new LambdaQueryWrapper<SysDept>().eq(SysDept::getHospId,id));
+        return AjaxResult.success(list);
+    }
+
+
+
 
     /**
      * 鏌ヨ闄㈠尯淇℃伅鍒楄〃
@@ -84,7 +95,11 @@
     @PostMapping
     @ApiOperation(value = "鏂板闄㈠尯淇℃伅")
     public AjaxResult add(@RequestBody DictHosp dictHosp) {
-        dictHosp.setHospName(orgService.getById(dictHosp.getHospid()).getOrgCnName());
+        if(null !=dictHosp.getHospid() ){
+            dictHosp.setHospName(orgService.getById(dictHosp.getHospid()).getOrgCnName());
+        }
+        dictHosp.setWbm(MatchUtils.toWubi(dictHosp.getHospAreaName()));
+        dictHosp.setSpell(PinyinUtil.getFirstLetter(dictHosp.getHospAreaName(),""));
         return toAjax(dictHospService.save(dictHosp));
     }
 

--
Gitblit v1.8.0