瀏覽代碼

新增病房科室字典维护

hsh 1 年之前
父節點
當前提交
42b2469a5b

+ 30 - 0
src/main/java/thyyxxk/webserver/controller/dictionary/BedDeptDictController.java

@@ -60,4 +60,34 @@ public class BedDeptDictController {
         return service.saveBedForDept(map);
     }
 
+    @GetMapping("/selectRoomDept")
+    public ResultVo<List<Map<String, Object>>> selectRoomDept(@RequestParam("text") String text){
+        return service.selectRoomDept(text);
+    }
+
+    @PostMapping("/saveRoomDept")
+    public ResultVo<Map<String, Object>> saveRoomDept(@RequestBody @Validated Map<String, Object> roomDept){
+        return service.saveRoomDept(roomDept);
+    }
+
+    @GetMapping("/delRoomDeptByCode")
+    public ResultVo<Map<String, Object>> delRoomDeptByCode(@RequestParam("wardCode") String wardCode, @RequestParam("deptCode") String deptCode){
+        return service.delRoomDeptByCode(wardCode, deptCode);
+    }
+
+    @GetMapping("/selectSmallDept")
+    public ResultVo<List<Map<String, Object>>> selectSmallDept(@RequestParam("text") String text){
+        return service.selectSmallDept(text);
+    }
+
+    @PostMapping("/saveSmallDept")
+    public ResultVo<Map<String, Object>> saveSmallDept(@RequestBody @Validated Map<String, Object> smallMap){
+        return service.saveSmallDept(smallMap);
+    }
+
+    @GetMapping("/delSmallDeptByCode")
+    public ResultVo<Map<String, Object>> delSmallDeptByCode(@RequestParam("deptId") String deptId){
+        return service.delSmallDeptByCode(deptId);
+    }
+
 }

+ 5 - 0
src/main/java/thyyxxk/webserver/controller/dictionary/PersonnelDictController.java

@@ -41,6 +41,11 @@ public class PersonnelDictController {
         this.service = service;
     }
 
+    @GetMapping("/selectZdUnitCode")
+    public ResultVo<List<ZdUnitCode>> selectZdUnitCode(@RequestParam("text") String text){
+        return service.selectZdUnitCode(text);
+    }
+
     @GetMapping("/selectDeptDict")
     public ResultVo<List<ZdUnitCode>> selectDeptDict(@RequestParam("text") String text){
         return service.selectDeptDict(text);

+ 92 - 0
src/main/java/thyyxxk/webserver/dao/his/dictionary/BedDeptDictDao.java

@@ -1,10 +1,12 @@
 package thyyxxk.webserver.dao.his.dictionary;
 
+import org.apache.ibatis.annotations.Delete;
 import org.apache.ibatis.annotations.Insert;
 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.yp.YpZdClass;
 
 import java.util.List;
 import java.util.Map;
@@ -127,4 +129,94 @@ public interface BedDeptDictDao {
             "  #{airConditionFee}, #{heatColdFlag}, #{sex}, #{type}, #{specialCharge}, #{chargeCodeBed}, #{chargeCodeAir}) ")
     int saveBedForDeptAndBedNo(Map<String, Object> bedInfo);
 
+    @Select(" select * from zy_adtward where ward_code = #{wardCode} and dept_code = #{deptCode} ")
+    Map<String, Object> selectRoomDeptByCode(@Param("wardCode") String wardCode, @Param("deptCode") String deptCode);
+
+    @Update("<script>" +
+            "update zy_adtward " +
+            "<trim prefix=\"set\" suffixOverrides=\",\">" +
+            "<if test=\"wardCode != null and wardCode != '' \">" +
+            "ward_code = #{wardCode}, " +
+            "</if>" +
+            "<if test=\"wardName != null and wardName != '' \">" +
+            "ward_name = #{wardName}, " +
+            "</if>" +
+            "<if test=\"deptCode != null and deptCode != '' \">" +
+            "dept_code = #{deptCode}, " +
+            "</if>" +
+            "<if test=\"deptName != null and deptName != '' \">" +
+            "dept_name = #{deptName}, " +
+            "</if>" +
+            "<if test=\"wardPyCode != null and wardPyCode != '' \">" +
+            "ward_py_code = #{wardPyCode}, " +
+            "</if>" +
+            "<if test=\"wardDCode != null and wardDCode != '' \">" +
+            "ward_d_code = #{wardDCode}, " +
+            "</if>" +
+            "<if test=\"deptPyCode != null and deptPyCode != '' \">" +
+            "dept_py_code = #{deptPyCode}, " +
+            "</if>" +
+            "<if test=\"deptDCode != null and deptDCode != '' \">" +
+            "dept_d_code = #{deptDCode}, " +
+            "</if>" +
+            "<if test=\"openbedNum != null and openbedNum != '' \">" +
+            "openbed_num = #{openbedNum}, " +
+            "</if>" +
+            "<if test=\"oweLimit != null and oweLimit != '' \">" +
+            "owe_limit = #{oweLimit}, " +
+            "</if>" +
+            "</trim>" +
+            "where ward_code = #{wardCode} and dept_code = #{deptCode} " +
+            "</script>")
+    int updateRoomDeptByCode(Map<String, Object> roomDept);
+
+    @Insert(" insert into zy_adtward(ward_code, dept_code, openbed_num, ward_name, dept_name, " +
+            "   ward_py_code, ward_d_code, dept_py_code, dept_d_code, owe_limit) " +
+            " values (#{wardCode}, #{deptCode}, #{openbedNum}, #{wardName}, #{deptName}, " +
+            "   #{wardPyCode}, #{wardDCode}, #{deptPyCode}, #{deptDCode}, #{oweLimit})")
+    int insertRoomDept(Map<String, Object> roomDept);
+
+    @Delete(" delete from zy_adtward where ward_code = #{wardCode} and dept_code = #{deptCode} ")
+    int deleteRoomDeptByCode(@Param("wardCode") String wardCode, @Param("deptCode") String deptCode);
+
+    @Select("select ad2.dept_code as deptCode, ad1.ward_code as wardCode, " +
+            "       ad2.dept_name as deptName, ad1.ward_name as wardName, " +
+            "       ad2.dept_py_code as deptPyCode, ad1.ward_py_code as wardPyCode, " +
+            "       ad2.dept_d_code as deptDCode, ad1.ward_d_code as wardDCode, " +
+            "       al.dept, al.small_dept as smallDept, al.dept_id as deptId  " +
+            "  from zd_dept_all as al " +
+            " inner join zy_adtward as ad1 on ad1.ward_code = al.dept " +
+            " inner join zy_adtward as ad2 on ad2.ward_code = al.small_dept " +
+            " where (ad1.dept_py_code like '${text}%' or ad1.ward_py_code like '${text}%' " +
+            "    or ad1.dept_d_code like '${text}%' or ad1.ward_d_code like '${text}%' " +
+            "    or ad1.dept_code like '${text}%' or ad1.ward_code like '${text}%' " +
+            "    or ad1.dept_name like '${text}%' or ad1.ward_name like '${text}%') ")
+    List<Map<String, Object>> selectSmallDept(@Param("text") String text);
+
+    @Select(" select * from zd_dept_all where dept_id = #{deptId}  ")
+    Map<String, Object> selectSmallDeptByCode(@Param("deptId") String deptId);
+
+    @Update("<script>" +
+            "update zd_dept_all " +
+            "<trim prefix=\"set\" suffixOverrides=\",\">" +
+            "<if test=\"dept != null and dept != '' \">" +
+            "dept = #{dept}, " +
+            "</if>" +
+            "<if test=\"smallDept != null and smallDept != '' \">" +
+            "small_dept = #{smallDept}, " +
+            "</if>" +
+            "<if test=\"deptId != null and deptId != '' \">" +
+            "dept_id = #{deptId}, " +
+            "</if>" +
+            "</trim>" +
+            "where dept_id = #{deptId} " +
+            "</script>")
+    int updateSmallDeptByCode(Map<String, Object> smallMap);
+
+    @Insert(" insert into zd_dept_all(dept, small_dept) values (#{dept}, #{smallDept})")
+    int insertSmallDept(Map<String, Object> smallMap);
+
+    @Delete(" delete from zd_dept_all where dept_id = #{deptId} ")
+    int deleteSmallDeptByCode(@Param("deptId") String deptId);
+
 }

+ 6 - 6
src/main/java/thyyxxk/webserver/dao/his/dictionary/ZdUnitCodeDao.java

@@ -10,12 +10,12 @@ import java.util.List;
 public interface ZdUnitCodeDao extends BaseMapper<ZdUnitCode> {
 
     @Select("<script>" +
-            "  select d.* from zd_unit_code d  " +
-            "   where isnull(d.py_code,'') like '%#{text}' " +
-            "     or isnull(d.d_code,'') like '%#{text}' " +
-            "     or isnull(d.code,'') like '%#{text}' " +
-            "     or isnull(d.n_code,'') like '%#{text}' " +
-            "     or isnull(d.name,'') like '%#{text}' " +
+            "  select d.code, d.name, d.py_code as pyCode, d.d_code as dCode from zd_unit_code as d  " +
+            "   where isnull(d.py_code,'') like '${text}%' " +
+            "     or isnull(d.d_code,'') like '${text}%' " +
+            "     or isnull(d.code,'') like '${text}%' " +
+            "     or isnull(d.n_code,'') like '${text}%' " +
+            "     or isnull(d.name,'') like '${text}%' " +
             "</script>")
     List<ZdUnitCode> selectZdUnitCode(@Param("text") String text);
 

+ 148 - 0
src/main/java/thyyxxk/webserver/service/dictionary/BedDeptDictService.java

@@ -5,6 +5,7 @@ import org.springframework.stereotype.Service;
 import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.dao.his.dictionary.BedDeptDictDao;
 import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.utils.PingYinUtils;
 import thyyxxk.webserver.utils.ResultVoUtil;
 import thyyxxk.webserver.utils.StringUtil;
 
@@ -127,4 +128,151 @@ public class BedDeptDictService {
         }
     }
 
+    /**
+     * @Description 查询病房科室字典
+     * @Author hsh
+     * @param text 关键字
+     * @return list
+     * @Date 2024/9/20 16:02
+     */
+    public ResultVo<List<Map<String, Object>>> selectRoomDept(String text){
+        return ResultVoUtil.success(dao.selectDeptInfoForBed(text));
+    }
+
+    /**
+     * @Description 更新病房科室字典
+     * @Author hsh
+     * @param roomDept 病房科室字典
+     * @return map
+     * @Date 2024/9/20 16:03
+     */
+    public ResultVo<Map<String, Object>> saveRoomDept(Map<String, Object> roomDept){
+        String wardCode = String.valueOf(roomDept.get("wardCode"));
+        String deptCode = String.valueOf(roomDept.get("deptCode"));
+        String wardName = String.valueOf(roomDept.get("wardName"));
+        String deptName = String.valueOf(roomDept.get("deptName"));
+        if(StringUtil.isBlank(wardCode) || StringUtil.isBlank(deptCode)){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "科室或者病区为空,请检查!");
+        }
+
+        Map<String, Object> resultMap = new HashMap<>();
+        Map<String, Object> room = dao.selectRoomDeptByCode(wardCode, deptCode);
+        // 根据名称生成新的拼音码和五笔码
+        roomDept.put("wardPyCode", PingYinUtils.pyShouZiMuDaXie(wardName).length() > 8 ? PingYinUtils.pyShouZiMuDaXie(wardName).substring(0,8) : PingYinUtils.pyShouZiMuDaXie(wardName));
+        roomDept.put("wardDCode", PingYinUtils.getWBCode(wardName).length() > 8 ? PingYinUtils.getWBCode(wardName).substring(0,8) : PingYinUtils.getWBCode(wardName));
+        roomDept.put("deptPyCode", PingYinUtils.pyShouZiMuDaXie(deptName).length() > 8 ? PingYinUtils.pyShouZiMuDaXie(deptName).substring(0,8) : PingYinUtils.pyShouZiMuDaXie(deptName));
+        roomDept.put("deptDCode", PingYinUtils.getWBCode(deptName).length() > 8 ? PingYinUtils.getWBCode(deptName).substring(0,8) : PingYinUtils.getWBCode(deptName));
+        int num;
+        try{
+            if(null != room){
+                num = dao.updateRoomDeptByCode(roomDept);
+            } else {
+                num = dao.insertRoomDept(roomDept);
+            }
+            if(num == 0){
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存病房科室字典失败!");
+            }
+            resultMap.put("cg", "保存病房科室字典成功!");
+            return ResultVoUtil.success(resultMap);
+        } catch(Exception e){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存病房科室字典失败!");
+        }
+    }
+
+    /**
+     * @Description 根据病房id,科室id删除病房科室字典
+     * @Author hsh
+     * @param wardCode 病房id
+     * @param deptCode 科室id
+     * @return map
+     * @Date 2024/9/20 16:03
+     */
+    public ResultVo<Map<String, Object>> delRoomDeptByCode(String wardCode, String deptCode) {
+        if (StringUtil.isBlank(wardCode) || StringUtil.isBlank(deptCode)) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "科室或者病区为空,请检查!");
+        }
+
+        Map<String, Object> resultMap = new HashMap<>();
+        try{
+            int num = dao.deleteRoomDeptByCode(wardCode, deptCode);
+            if(num == 0){
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除病房科室字典失败!");
+            }
+            resultMap.put("cg", "删除病房科室字典成功!");
+            return ResultVoUtil.success(resultMap);
+        } catch(Exception e){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除病房科室字典失败!");
+        }
+    }
+
+    /**
+     * @Description 查询小科室字典
+     * @Author hsh
+     * @param text 关键字
+     * @return list
+     * @Date 2024/9/20 16:05
+     */
+    public ResultVo<List<Map<String, Object>>> selectSmallDept(String text){
+        return ResultVoUtil.success(dao.selectSmallDept(text));
+    }
+
+    /**
+     * @Description 更新小科室字典
+     * @Author hsh
+     * @param smallMap 小科室字典
+     * @return map
+     * @Date 2024/9/20 16:05
+     */
+    public ResultVo<Map<String, Object>> saveSmallDept(Map<String, Object> smallMap){
+        String dept = String.valueOf(smallMap.get("dept"));
+        String smallDept = String.valueOf(smallMap.get("smallDept"));
+        String deptId = String.valueOf(smallMap.get("deptId"));
+        if(StringUtil.isBlank(dept) || StringUtil.isBlank(smallDept)){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "小科室或者病区为空,请检查!");
+        }
+
+        Map<String, Object> resultMap = new HashMap<>();
+        Map<String, Object> small = dao.selectSmallDeptByCode(deptId);
+        int num;
+        try{
+            if(null != small){
+                num = dao.updateSmallDeptByCode(smallMap);
+            } else {
+                num = dao.insertSmallDept(smallMap);
+            }
+            if(num == 0){
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存小科室字典失败!");
+            }
+            resultMap.put("cg", "保存小科室字典成功!");
+            return ResultVoUtil.success(resultMap);
+        } catch(Exception e){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存小科室字典失败!");
+        }
+    }
+
+    /**
+     * @Description 根据科室序列号删除小科室字典
+     * @Author hsh
+     * @param deptId 科室序列号
+     * @return map
+     * @Date 2024/9/20 16:05
+     */
+    public ResultVo<Map<String, Object>> delSmallDeptByCode(String deptId) {
+        if (StringUtil.isBlank(deptId)) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "科室序列号为空,请检查!");
+        }
+
+        Map<String, Object> resultMap = new HashMap<>();
+        try{
+            int num = dao.deleteSmallDeptByCode(deptId);
+            if(num == 0){
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除小科室字典失败!");
+            }
+            resultMap.put("cg", "删除小科室字典成功!");
+            return ResultVoUtil.success(resultMap);
+        } catch(Exception e){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除小科室字典失败!");
+        }
+    }
+
 }

+ 4 - 0
src/main/java/thyyxxk/webserver/service/dictionary/PersonnelDictService.java

@@ -83,6 +83,10 @@ public class PersonnelDictService {
         this.employeeMiDao = employeeMiDao;
     }
 
+    public ResultVo<List<ZdUnitCode>> selectZdUnitCode(String text){
+        return ResultVoUtil.success(deptDao.selectZdUnitCode(text));
+    }
+
     /**
      * @description: 查询科室字典信息
      * @author: hsh