ソースを参照

体温脉搏阈值

lihong 1 年間 前
コミット
5fa6d88c79

+ 16 - 0
src/main/java/thyyxxk/webserver/controller/medicaladvice/nursing/NursingManagementController.java

@@ -182,4 +182,20 @@ public class NursingManagementController {
     public ResultVo<List<CodeName>> getAllWards(){
         return service.getAllWards();
     }
+    /**
+     * @description: 查询体温脉搏范围值
+     * @author: lihong
+     * @date: 2024/1/30 10:37
+     * @return: thyyxxk.webserver.entity.ResultVo<java.util.List<java.util.Map<java.lang.String,java.lang.Object>>>
+     **/
+    @GetMapping("queryTwMbRange")
+    public ResultVo<Map<String,Object>> queryTwMbRange(){
+        return service.queryTwMbRange();
+    }
+
+    @PostMapping("saveTwMbRange")
+    public ResultVo<Patient> saveTwMbRange(@RequestBody Map<String,Object> param){
+        return service.saveTwMbRange(param);
+    }
+
 }

+ 19 - 0
src/main/java/thyyxxk/webserver/dao/his/medicaladvice/common/DictDataDao.java

@@ -0,0 +1,19 @@
+package thyyxxk.webserver.dao.his.medicaladvice.common;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+
+/**
+ * @Description:
+ * @Author:lihong
+ * @Date: 2024/1/30
+ */
+@Mapper
+public interface DictDataDao {
+    @Select("select dict_value from   t_dict_data where dict_type=#{dictType} and dict_name=#{dictName} and status='0'")
+    String getDictValueByDictName(@Param("dictType") String dictType, @Param("dictName")String dictName);
+    @Update(" update t_dict_data set dict_value =#{dictValue} where dict_type=#{dictType} and dict_name=#{dictName} ")
+    int updateDictValue(@Param("dictValue") String dictValue,@Param("dictType") String dictType, @Param("dictName") String dictName);
+}

+ 74 - 0
src/main/java/thyyxxk/webserver/service/medicaladvice/nursing/NursingManagementService.java

@@ -7,6 +7,7 @@ import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUnit;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.map.MapUtil;
+import cn.hutool.core.util.NumberUtil;
 import cn.hutool.core.util.ReflectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
@@ -22,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import thyyxxk.webserver.config.exception.BizException;
 import thyyxxk.webserver.config.exception.ExceptionEnum;
+import thyyxxk.webserver.dao.his.medicaladvice.common.DictDataDao;
 import thyyxxk.webserver.dao.his.medicaladvice.nursing.NursingManagementDao;
 import thyyxxk.webserver.dao.his.medicaladvice.nursing.YzHlMbDao;
 import thyyxxk.webserver.dao.his.medicaladvice.nursing.YzTemperatureMapper;
@@ -48,6 +50,7 @@ import thyyxxk.webserver.utils.EntityStringTrim;
 import thyyxxk.webserver.utils.ResultVoUtil;
 import thyyxxk.webserver.utils.StringUtil;
 
+import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Comparator;
@@ -80,6 +83,8 @@ public class NursingManagementService {
     private YiZhuPublicDao yiZhuPublicDao;
     @Autowired
     private  UpIdCollectionDao upIdCollectionDao;
+    @Resource
+    private DictDataDao dictDataDao;
 
 
 
@@ -357,6 +362,7 @@ public class NursingManagementService {
 
     public ResultVo<String> saveThreeTest(YzTemperatureVO saveData) {
        if(CollUtil.isNotEmpty(saveData.getYzTemperatureVOS())){
+           checkTwMbRange(saveData);
            List<YzTemperatureVO> yzTemperatureVOS = dealYzTemperatureVOS(saveData);
            log.info("yzTemperatureVOS", JSON.toJSONString(yzTemperatureVOS));
            List<YzTemperatureVO> exist = yzTemperatureVOS.stream().filter(item -> item.getDetailNo() != null).collect(Collectors.toList());
@@ -383,6 +389,24 @@ public class NursingManagementService {
         return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION,"保存成功");
     }
 
+    private void checkTwMbRange(YzTemperatureVO data){
+       if(CollUtil.isNotEmpty(data.getYzTemperatureVOS())){
+           String twRange = dictDataDao.getDictValueByDictName("2.2", "tw_range");
+           String mbRange = dictDataDao.getDictValueByDictName("2.3", "mb_range");
+           int index = 1;
+           for(YzTemperatureVO item : data.getYzTemperatureVOS()){
+               if(item.getTemperature() ==null || Convert.toBigDecimal(twRange.split(",")[0]).compareTo(item.getTemperature()) > 0 || Convert.toBigDecimal(twRange.split(",")[1]).compareTo(item.getTemperature()) < 0){
+                   throw new BizException(ExceptionEnum.LOGICAL_ERROR, StrUtil.format("第{}条体温要在{}至{}范围内",index, twRange.split(",")[0], twRange.split(",")[1]));
+               }
+               if(item.getPulse() ==null || Convert.toBigDecimal(mbRange.split(",")[0]).compareTo(item.getPulse()) > 0 || Convert.toBigDecimal(mbRange.split(",")[1]).compareTo(item.getPulse()) < 0){
+                   throw new BizException(ExceptionEnum.LOGICAL_ERROR, StrUtil.format("第{}条脉搏要在{}至{}范围内",index, mbRange.split(",")[0], mbRange.split(",")[1]));
+               }
+               ++index;
+           }
+       }
+    }
+
+
     public List<YzTemperatureSum> dealYzTemperatureSums(YzTemperatureVO saveData) {
         List<YzTemperatureSum> yzTemperatureSums = saveData.getYzTemperatureSums();
         Date now = new Date();
@@ -567,8 +591,20 @@ public class NursingManagementService {
       return  dao.listOrderTime(patient.getInpatientNo(),patient.getAdmissTimes());
     }
 
+    private void checkHlTwMb(BigDecimal pulse1,BigDecimal temperature1){
+        String twRange = dictDataDao.getDictValueByDictName("2.2", "tw_range");
+        String mbRange = dictDataDao.getDictValueByDictName("2.3", "mb_range");
+        if(Convert.toBigDecimal(twRange.split(",")[0]).compareTo(temperature1) > 0 || Convert.toBigDecimal(twRange.split(",")[1]).compareTo(temperature1) < 0){
+            throw new BizException(ExceptionEnum.LOGICAL_ERROR, StrUtil.format("体温要在{}至{}范围内",twRange.split(",")[0],twRange.split(",")[1]));
+        }
+        if(Convert.toBigDecimal(mbRange.split(",")[0]).compareTo(pulse1) > 0 || Convert.toBigDecimal(mbRange.split(",")[1]).compareTo(pulse1) < 0){
+            throw new BizException(ExceptionEnum.LOGICAL_ERROR, StrUtil.format("脉搏要在{}至{}范围内",mbRange.split(",")[0],mbRange.split(",")[1]));
+        }
+    }
+
     public ResultVo<String> saveYzTemperature(YzTemperatureVO query) {
         AssertUtil.isnotBlank(query.getRecTime(),"时间不能为空!");
+        checkHlTwMb(query.getPulse1(), query.getTemperature1());
         //先查询是否存在
         query.setRecTimeStr(DateUtil.format(query.getRecTime(),"HH:mm:ss"));
         query.setToStringRecTime(query.getRecTimeStr());
@@ -1048,4 +1084,42 @@ public class NursingManagementService {
     public ResultVo<List<CodeName>> getAllWards() {
         return ResultVoUtil.success(yiZhuPublicDao.getAllWards());
     }
+
+    public ResultVo<Map<String, Object>> queryTwMbRange() {
+        Map<String, Object>  result = new HashMap<>(10);
+        String twRange = dictDataDao.getDictValueByDictName("2.2", "tw_range");
+        String mbRange = dictDataDao.getDictValueByDictName("2.3", "mb_range");
+        try {
+            result.put("twStart", twRange.split(",")[0]);
+            result.put("twEnd", twRange.split(",")[1]);
+            result.put("mbStart", mbRange.split(",")[0]);
+            result.put("mbEnd", mbRange.split(",")[1]);
+        }catch (Exception e){
+
+        }
+        return ResultVoUtil.success(result);
+    }
+
+    public ResultVo<Patient> saveTwMbRange(Map<String, Object> param) {
+       String twStart = Convert.toStr(param.get("twStart"));
+       String twEnd = Convert.toStr(param.get("twEnd"));
+       String mbStart = Convert.toStr(param.get("mbStart"));
+       String mbEnd = Convert.toStr(param.get("mbEnd"));
+       AssertUtil.isnotBlank(twStart,"体温开始值不能为空");
+       AssertUtil.isnotBlank(twEnd,"体温结束值不能为空");
+       AssertUtil.isnotBlank(mbStart,"脉搏开始值不能为空");
+       AssertUtil.isnotBlank(mbEnd,"脉搏结束值不能为空");
+       if(!NumberUtil.isNumber(twStart) ||!NumberUtil.isNumber(twEnd) ||!NumberUtil.isNumber(mbStart) || !NumberUtil.isNumber(mbEnd)){
+           throw new BizException(ExceptionEnum.LOGICAL_ERROR, "体温或脉搏值要为数字");
+       }
+       if(Convert.toBigDecimal(twStart).compareTo(Convert.toBigDecimal(twEnd)) > 0){
+           throw new BizException(ExceptionEnum.LOGICAL_ERROR, "体温开始值不能大于结束值");
+       }
+        if(Convert.toBigDecimal(mbStart).compareTo(Convert.toBigDecimal(mbEnd)) > 0){
+            throw new BizException(ExceptionEnum.LOGICAL_ERROR, "脉搏开始值不能大于结束值");
+        }
+        dictDataDao.updateDictValue(twStart + "," + twEnd, "2.2", "tw_range");
+        dictDataDao.updateDictValue(mbStart + "," + mbEnd, "2.3", "mb_range");
+       return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION);
+    }
 }