瀏覽代碼

Merge branch 'master' of https://172.16.32.165/lighter/web-server

xiaochan 11 月之前
父節點
當前提交
ec89365a34

+ 7 - 2
src/main/java/thyyxxk/webserver/controller/dictionary/BedDeptDictController.java

@@ -36,8 +36,8 @@ public class BedDeptDictController {
     }
 
     @GetMapping("/selectBedInfoForDept")
-    public ResultVo<List<Map<String, Object>>> selectBedInfoForDept(@RequestParam("deptCode") String deptCode){
-        return service.selectBedInfoForDept(deptCode);
+    public ResultVo<List<Map<String, Object>>> selectBedInfoForDept(@RequestParam("wardCode") String wardCode){
+        return service.selectBedInfoForDept(wardCode);
     }
 
     @GetMapping("/selectAirItemInfo")
@@ -55,4 +55,9 @@ public class BedDeptDictController {
         return service.updateBedInfoForDept(bedInfoList);
     }
 
+    @PostMapping("/saveBedForDept")
+    public ResultVo<Map<String, Object>> saveBedForDept(@RequestBody @Validated Map<String, Object> map){
+        return service.saveBedForDept(map);
+    }
+
 }

+ 12 - 2
src/main/java/thyyxxk/webserver/dao/his/dictionary/BedDeptDictDao.java

@@ -1,5 +1,6 @@
 package thyyxxk.webserver.dao.his.dictionary;
 
+import org.apache.ibatis.annotations.Insert;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
@@ -67,9 +68,9 @@ public interface BedDeptDictDao {
             "      on b.charge_code_bed = t.code " +
             "    left join zd_charge_item as s  " +
             "      on b.charge_code_air = s.code " +
-            "   where b.ward_code = #{deptCode} " +
+            "   where b.ward_code = #{wardCode} " +
             "order by b.bed_no ")
-    List<Map<String, Object>> selectBedInfoForDept(@Param("deptCode") String deptCode);
+    List<Map<String, Object>> selectBedInfoForDept(@Param("wardCode") String wardCode);
 
     @Select("  select a.code as value,   " +
             "         a.exec_unit as execUnit,   " +
@@ -117,4 +118,13 @@ public interface BedDeptDictDao {
             "</script>")
     int updateBedInfoForDept(@Param("list") List<Map<String, Object>> list);
 
+    @Select(" select count(*) as num from zy_bed_mi where ward_code = #{wardCode} and dept_code = #{deptCode} and bed_no = #{bedNo} ")
+    int selectBedInfoForDeptAndBedNo(@Param("wardCode") String wardCode, @Param("deptCode") String deptCode, @Param("bedNo") String bedNo);
+
+    @Insert("insert into zy_bed_mi (ward_code, bed_no, room_no, dept_code, bed_status, room_rate1, room_rate2, heating_fee," +
+            " aircondition_fee, heatcold_flag, sex, type, special_charge, charge_code_bed, charge_code_air) values " +
+            " (#{wardCode}, #{bedNo}, #{roomNo}, #{deptCode}, #{bedStatus}, #{roomRate1}, #{roomRate2}, #{heatingFee}," +
+            "  #{airConditionFee}, #{heatColdFlag}, #{sex}, #{type}, #{specialCharge}, #{chargeCodeBed}, #{chargeCodeAir}) ")
+    int saveBedForDeptAndBedNo(Map<String, Object> bedInfo);
+
 }

+ 33 - 4
src/main/java/thyyxxk/webserver/service/dictionary/BedDeptDictService.java

@@ -6,6 +6,7 @@ import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.dao.his.dictionary.BedDeptDictDao;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.utils.ResultVoUtil;
+import thyyxxk.webserver.utils.StringUtil;
 
 import java.util.HashMap;
 import java.util.List;
@@ -40,14 +41,14 @@ public class BedDeptDictService {
     }
 
     /**
-     * @Description 根据科室id查询床位基本信息
+     * @Description 根据病房id查询床位基本信息
      * @Author hsh
-     * @param deptCode 科室id
+     * @param wardCode 病房id
      * @return list
      * @Date 2024/9/12 15:02
      */
-    public ResultVo<List<Map<String, Object>>> selectBedInfoForDept(String deptCode){
-        return ResultVoUtil.success(dao.selectBedInfoForDept(deptCode));
+    public ResultVo<List<Map<String, Object>>> selectBedInfoForDept(String wardCode){
+        return ResultVoUtil.success(dao.selectBedInfoForDept(wardCode));
     }
 
     /**
@@ -98,4 +99,32 @@ public class BedDeptDictService {
         }
     }
 
+    /**
+     * @Description 新增科室床位信息
+     * @Author hsh
+     * @param bedInfo 科室床位信息
+     * @return map
+     * @Date 2024/9/19 16:23
+     */
+    public ResultVo<Map<String, Object>> saveBedForDept(Map<String, Object> bedInfo){
+        Map<String, Object> map = new HashMap<>();
+        String wardCode = String.valueOf(bedInfo.get("wardCode"));
+        String deptCode = String.valueOf(bedInfo.get("deptCode"));
+        String bedNo = String.valueOf(bedInfo.get("bedNo"));
+        if(StringUtil.isBlank(wardCode) || StringUtil.isBlank(deptCode) || StringUtil.isBlank(bedNo)){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "科室,病区或者床号为空,请检查!");
+        }
+        int num = dao.selectBedInfoForDeptAndBedNo(wardCode, deptCode, bedNo);
+        if(num > 0){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, bedNo + "此床号已存在,请检查!");
+        }
+        int n = dao.saveBedForDeptAndBedNo(bedInfo);
+        if(n > 0){
+            map.put("cg", "新增科室床位信息成功!");
+            return ResultVoUtil.success(map);
+        } else {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "新增科室床位信息失败,请检查!");
+        }
+    }
+
 }