123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- 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 thyyxxk.webserver.utils.StringUtil;
- 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 wardCode 病房id
- * @return list
- * @Date 2024/9/12 15:02
- */
- public ResultVo<List<Map<String, Object>>> selectBedInfoForDept(String wardCode){
- return ResultVoUtil.success(dao.selectBedInfoForDept(wardCode));
- }
- /**
- * @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, "更新科室床位信息失败,请检查!");
- }
- }
- /**
- * @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, "新增科室床位信息失败,请检查!");
- }
- }
- }
|