Prechádzať zdrojové kódy

Merge branch 'master' into 'master'

新增科室床位维护

See merge request lighter/web-server!108
huangshuhua 1 rok pred
rodič
commit
6f5b7c0335

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

@@ -0,0 +1,58 @@
+package thyyxxk.webserver.controller.dictionary;
+
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.service.dictionary.BedDeptDictService;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @ClassName BedDeptDictController
+ * @Author hsh
+ * @Date 2024/9/9 15:59
+ * @Version 1.0
+ * @Description 床位(科室)字典维护
+ **/
+@RestController
+@RequestMapping("/bedDict")
+public class BedDeptDictController {
+
+    private final BedDeptDictService service;
+
+    public BedDeptDictController(BedDeptDictService service) {
+        this.service = service;
+    }
+
+    @GetMapping("/selectDeptInfoForBed")
+    public ResultVo<List<Map<String, Object>>> selectDeptInfoForBed(@RequestParam("text") String text){
+        return service.selectDeptInfoForBed(text);
+    }
+
+    @GetMapping("/selectBedInfoForDept")
+    public ResultVo<List<Map<String, Object>>> selectBedInfoForDept(@RequestParam("deptCode") String deptCode){
+        return service.selectBedInfoForDept(deptCode);
+    }
+
+    @GetMapping("/selectAirItemInfo")
+    public ResultVo<List<Map<String, Object>>> selectAirItemInfo(@RequestParam("text") String text){
+        return service.selectAirItemInfo(text);
+    }
+
+    @PostMapping("/updateDeptInfoForBed")
+    public ResultVo<Map<String, Object>> updateDeptInfoForBed(@RequestBody @Validated List<Map<String, Object>> deptInfoList){
+        return service.updateDeptInfoForBed(deptInfoList);
+    }
+
+    @PostMapping("/updateBedInfoForDept")
+    public ResultVo<Map<String, Object>> updateBedInfoForDept(@RequestBody @Validated List<Map<String, Object>> bedInfoList){
+        return service.updateBedInfoForDept(bedInfoList);
+    }
+
+}

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

@@ -0,0 +1,120 @@
+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 java.util.List;
+import java.util.Map;
+
+@Mapper
+public interface BedDeptDictDao {
+
+    @Select("  select a.ward_code as wardCode,   " +
+            "         a.dept_code as deptCode,   " +
+            "         a.openbed_num as openBedNum,   " +
+            "         a.borrowbed_num as borrowBedNum,   " +
+            "         a.lentbed_num as lentbedNum,   " +
+            "         rtrim(a.ward_name) as wardName,   " +
+            "         rtrim(a.dept_name) as deptName,  " +
+            "         rtrim(a.ward_py_code) as wardPyCode,   " +
+            "         rtrim(a.ward_d_code) as wardDCode,   " +
+            "         rtrim(a.dept_py_code) as deptPyCode,   " +
+            "         rtrim(a.dept_d_code) as deptDCode,   " +
+            "         a.start_day_time_kf as startDayTimeKf,   " +
+            "         a.ward_only as wardOnly,   " +
+            "         a.deposit_limit as depositLimit,   " +
+            "         a.owe_limit as oweLimit  " +
+            "    from zy_adtward as a   " +
+            "   where (a.dept_py_code like '${text}%' or a.ward_py_code like '${text}%') " +
+            "      or (a.dept_d_code like '${text}%' or a.ward_d_code like '${text}%') " +
+            "      or (a.dept_code like '${text}%' or a.ward_code like '${text}%') " +
+            "      or (a.dept_name like '${text}%' or a.ward_name like '${text}%') " +
+            "order by a.dept_code,a.ward_code  ")
+    List<Map<String, Object>> selectDeptInfoForBed(@Param("text") String text);
+
+    @Select("  select b.ward_code as wardCode,   " +
+            "         b.bed_status as bedStatus, " +
+            "         case when b.bed_status = '2' then '占用' else '空闲' end as bedStatusName, " +
+            "         b.bed_no as bedNo,   " +
+            "         b.room_no as roomNo,   " +
+            "         b.dept_code as deptCode,   " +
+            "         b.room_rate1 as roomRate1,   " +
+            "         b.room_rate2 as roomRate2,   " +
+            "         b.eff_date1 as effDate1,   " +
+            "         b.eff_date2 as effDate2,   " +
+            "         b.heating_fee as heatingFee,   " +
+            "         b.aircondition_fee as airConditionFee,   " +
+            "         b.heatcold_flag as heatColdFlag,  " +
+            "         b.inpatient_no as inpatientNo,   " +
+            "         b.admiss_times as admissTimes,   " +
+            "         b.sex,   " +
+            "         b.percent2,   " +
+            "         b.percent3,   " +
+            "         b.percent4,   " +
+            "         b.percent5,   " +
+            "         b.type,   " +
+            "         b.percent1,   " +
+            "         b.special_charge as specialCharge,   " +
+            "         b.remark,   " +
+            "         b.zy_serial_no as zySerialNo,  " +
+            "         b.charge_code_bed as chargeCodeBed,  " +
+            "         rtrim(t.name) as chargeCodeBedName,  " +
+            "         b.charge_code_air as chargeCodeAir,  " +
+            "         rtrim(s.name) as chargeCodeAirName " +
+            "    from zy_bed_mi as b left join zd_charge_item as t " +
+            "      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} " +
+            "order by b.bed_no ")
+    List<Map<String, Object>> selectBedInfoForDept(@Param("deptCode") String deptCode);
+
+    @Select("  select a.code as value,   " +
+            "         a.exec_unit as execUnit,   " +
+            "         a.name as label,   " +
+            "         a.charge_amount as price,   " +
+            "         a.bill_item_zy as billItemCode,   " +
+            "         a.py_code as pyCode,   " +
+            "         a.d_code as dCode,   " +
+            "         isnull(a.suppress_flag,'0') as suppressFlag,   " +
+            "         a.bill_item_out as billItemOut,   " +
+            "         a.n_code as nCode,   " +
+            "         isnull(a.self_flag,'0') as selfFlag,   " +
+            "         isnull(a.separate_flag,'0') as separateFlag ," +
+            "         a.charge_unit as spec, " +
+            "         b.name as execName,   " +
+            "         '00' as serial, " +
+            "         '00' as groupNo " +
+            "    from zd_charge_item a left join zd_unit_code b on a.exec_unit = b.code " +
+            "   where isnull(a.del_flag,'') <> '1'  " +
+            "     and isnull(a.in_out_flag,'') <> '1'  " +
+            "     and (a.py_code like '${text}%'  " +
+            "      or a.d_code like '${text}%'   " +
+            "      or a.code like '${text}%' " +
+            "      or a.name like '${text}%' " +
+            "      or a.n_code like '${text}%')  " +
+            "order by a.name ")
+    List<Map<String, Object>> selectAirItemInfo(@Param("text") String text);
+
+    @Update("<script>" +
+            "<foreach item='item' collection='list' >" +
+            " update zy_adtward set openbed_num = #{item.openBedNum} " +
+            " where ward_code = #{item.deptCode} and dept_code = #{item.deptCode} " +
+            "</foreach>" +
+            "</script>")
+    int updateDeptInfoForBed(@Param("list") List<Map<String, Object>> list);
+
+    @Update("<script>" +
+            "<foreach item='item' collection='list' >" +
+            " update zy_bed_mi set type = #{item.type}, bed_no = #{item.bedNo}, room_no = #{item.roomNo}, sex = #{item.sex}, " +
+            "   room_rate1 = #{item.roomRate1}, charge_code_bed = #{item.chargeCodeBed}, heating_fee = #{item.heatingFee}, " +
+            "   aircondition_fee = #{item.airConditionFee}, charge_code_air = #{item.chargeCodeAir}, special_charge = #{item.specialCharge}, " +
+            "   room_rate2 = #{item.roomRate2}, heatcold_flag = #{item.heatColdFlag} " +
+            " where ward_code = #{item.deptCode} and bed_no = #{item.bedNo} and dept_code = #{item.deptCode} " +
+            "</foreach>" +
+            "</script>")
+    int updateBedInfoForDept(@Param("list") List<Map<String, Object>> list);
+
+}

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

@@ -0,0 +1,101 @@
+package thyyxxk.webserver.service.dictionary;
+
+import lombok.extern.slf4j.Slf4j;
+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.ResultVoUtil;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @ClassName BedDeptDictService
+ * @Author hsh
+ * @Date 2024/9/9 16:01
+ * @Version 1.0
+ * @Description 床位(科室)字典维护
+ **/
+@Service
+@Slf4j
+public class BedDeptDictService {
+
+    private final BedDeptDictDao dao;
+
+    public BedDeptDictService(BedDeptDictDao dao) {
+        this.dao = dao;
+    }
+
+    /**
+     * @Description 查询科室标准床位信息
+     * @Author hsh
+     * @param text 关键字
+     * @return list
+     * @Date 2024/9/12 15:01
+     */
+    public ResultVo<List<Map<String, Object>>> selectDeptInfoForBed(String text){
+        return ResultVoUtil.success(dao.selectDeptInfoForBed(text));
+    }
+
+    /**
+     * @Description 根据科室id查询床位基本信息
+     * @Author hsh
+     * @param deptCode 科室id
+     * @return list
+     * @Date 2024/9/12 15:02
+     */
+    public ResultVo<List<Map<String, Object>>> selectBedInfoForDept(String deptCode){
+        return ResultVoUtil.success(dao.selectBedInfoForDept(deptCode));
+    }
+
+    /**
+     * @Description 查询空调费/床位费项目信息
+     * @Author hsh
+     * @param text 关键字
+     * @return list
+     * @Date 2024/9/12 15:03
+     */
+    public ResultVo<List<Map<String, Object>>> selectAirItemInfo(String text){
+        List<Map<String, Object>> list = dao.selectAirItemInfo(text);
+        return ResultVoUtil.success(list);
+    }
+
+    /**
+     * @Description 更新科室标准床位数
+     * @Author hsh
+     * @param deptInfoList 科室标准床位数
+     * @return map
+     * @Date 2024/9/14 12:06
+     */
+    public ResultVo<Map<String, Object>> updateDeptInfoForBed(List<Map<String, Object>> deptInfoList){
+        Map<String, Object> map = new HashMap<>();
+        int n = dao.updateDeptInfoForBed(deptInfoList);
+        if(n > 0){
+            map.put("cg", "更新科室标准床位数成功!");
+            return ResultVoUtil.success(map);
+        } else {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "更新科室标准床位数失败,请检查!");
+        }
+    }
+
+    /**
+     * @Description 根据科室id更新科室床位信息
+     * @Author hsh
+     * @param bedInfoList 科室床位信息
+     * @return map
+     * @Date 2024/9/18 10:35
+     */
+    public ResultVo<Map<String, Object>> updateBedInfoForDept(List<Map<String, Object>> bedInfoList){
+        Map<String, Object> map = new HashMap<>();
+        int n = dao.updateBedInfoForDept(bedInfoList);
+        if(n > 0){
+            map.put("cg", "更新科室床位信息成功!");
+            return ResultVoUtil.success(map);
+        } else {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "更新科室床位信息失败,请检查!");
+        }
+    }
+
+}