|
@@ -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);
|
|
|
+ }
|
|
|
}
|