BedDeptDictService.java 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. package thyyxxk.webserver.service.dictionary;
  2. import lombok.extern.slf4j.Slf4j;
  3. import org.springframework.stereotype.Service;
  4. import thyyxxk.webserver.config.exception.ExceptionEnum;
  5. import thyyxxk.webserver.dao.his.dictionary.BedDeptDictDao;
  6. import thyyxxk.webserver.entity.ResultVo;
  7. import thyyxxk.webserver.utils.ResultVoUtil;
  8. import thyyxxk.webserver.utils.StringUtil;
  9. import java.util.HashMap;
  10. import java.util.List;
  11. import java.util.Map;
  12. /**
  13. * @ClassName BedDeptDictService
  14. * @Author hsh
  15. * @Date 2024/9/9 16:01
  16. * @Version 1.0
  17. * @Description 床位(科室)字典维护
  18. **/
  19. @Service
  20. @Slf4j
  21. public class BedDeptDictService {
  22. private final BedDeptDictDao dao;
  23. public BedDeptDictService(BedDeptDictDao dao) {
  24. this.dao = dao;
  25. }
  26. /**
  27. * @Description 查询科室标准床位信息
  28. * @Author hsh
  29. * @param text 关键字
  30. * @return list
  31. * @Date 2024/9/12 15:01
  32. */
  33. public ResultVo<List<Map<String, Object>>> selectDeptInfoForBed(String text){
  34. return ResultVoUtil.success(dao.selectDeptInfoForBed(text));
  35. }
  36. /**
  37. * @Description 根据病房id查询床位基本信息
  38. * @Author hsh
  39. * @param wardCode 病房id
  40. * @return list
  41. * @Date 2024/9/12 15:02
  42. */
  43. public ResultVo<List<Map<String, Object>>> selectBedInfoForDept(String wardCode){
  44. return ResultVoUtil.success(dao.selectBedInfoForDept(wardCode));
  45. }
  46. /**
  47. * @Description 查询空调费/床位费项目信息
  48. * @Author hsh
  49. * @param text 关键字
  50. * @return list
  51. * @Date 2024/9/12 15:03
  52. */
  53. public ResultVo<List<Map<String, Object>>> selectAirItemInfo(String text){
  54. List<Map<String, Object>> list = dao.selectAirItemInfo(text);
  55. return ResultVoUtil.success(list);
  56. }
  57. /**
  58. * @Description 更新科室标准床位数
  59. * @Author hsh
  60. * @param deptInfoList 科室标准床位数
  61. * @return map
  62. * @Date 2024/9/14 12:06
  63. */
  64. public ResultVo<Map<String, Object>> updateDeptInfoForBed(List<Map<String, Object>> deptInfoList){
  65. Map<String, Object> map = new HashMap<>();
  66. int n = dao.updateDeptInfoForBed(deptInfoList);
  67. if(n > 0){
  68. map.put("cg", "更新科室标准床位数成功!");
  69. return ResultVoUtil.success(map);
  70. } else {
  71. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "更新科室标准床位数失败,请检查!");
  72. }
  73. }
  74. /**
  75. * @Description 根据科室id更新科室床位信息
  76. * @Author hsh
  77. * @param bedInfoList 科室床位信息
  78. * @return map
  79. * @Date 2024/9/18 10:35
  80. */
  81. public ResultVo<Map<String, Object>> updateBedInfoForDept(List<Map<String, Object>> bedInfoList){
  82. Map<String, Object> map = new HashMap<>();
  83. int n = dao.updateBedInfoForDept(bedInfoList);
  84. if(n > 0){
  85. map.put("cg", "更新科室床位信息成功!");
  86. return ResultVoUtil.success(map);
  87. } else {
  88. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "更新科室床位信息失败,请检查!");
  89. }
  90. }
  91. /**
  92. * @Description 新增科室床位信息
  93. * @Author hsh
  94. * @param bedInfo 科室床位信息
  95. * @return map
  96. * @Date 2024/9/19 16:23
  97. */
  98. public ResultVo<Map<String, Object>> saveBedForDept(Map<String, Object> bedInfo){
  99. Map<String, Object> map = new HashMap<>();
  100. String wardCode = String.valueOf(bedInfo.get("wardCode"));
  101. String deptCode = String.valueOf(bedInfo.get("deptCode"));
  102. String bedNo = String.valueOf(bedInfo.get("bedNo"));
  103. if(StringUtil.isBlank(wardCode) || StringUtil.isBlank(deptCode) || StringUtil.isBlank(bedNo)){
  104. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "科室,病区或者床号为空,请检查!");
  105. }
  106. int num = dao.selectBedInfoForDeptAndBedNo(wardCode, deptCode, bedNo);
  107. if(num > 0){
  108. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, bedNo + "此床号已存在,请检查!");
  109. }
  110. int n = dao.saveBedForDeptAndBedNo(bedInfo);
  111. if(n > 0){
  112. map.put("cg", "新增科室床位信息成功!");
  113. return ResultVoUtil.success(map);
  114. } else {
  115. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "新增科室床位信息失败,请检查!");
  116. }
  117. }
  118. }