|
|
@@ -2,6 +2,7 @@ package com.tuoren.web.layer.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.crypto.digest.DigestUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
@@ -16,10 +17,12 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author wangzl
|
|
|
@@ -44,12 +47,24 @@ public class BusReceiveRecordUpdateImpl extends ServiceImpl<BusReceiveRecordUpda
|
|
|
log.info("泵表数据为空");
|
|
|
return;
|
|
|
}
|
|
|
+ if(StrUtil.isBlank(pumpEntity.getPatientCode())){
|
|
|
+ log.info("患者编码为空 对象 {}", pumpEntity);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(StrUtil.isBlank(pumpEntity.getHospitalCode())){
|
|
|
+ log.info("医院编码为空 对象 {}", pumpEntity);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(StrUtil.isBlank(pumpEntity.getPumpCode())){
|
|
|
+ log.info("泵编码为空 传入内容 {}", pumpEntity);
|
|
|
+ return;
|
|
|
+ }
|
|
|
BusReceiveRecordUpdateEntity busReceiveRecordUpdateEntity = this.getBaseMapper().selectOne(new LambdaQueryWrapper<BusReceiveRecordUpdateEntity>()
|
|
|
.eq(BusReceiveRecordUpdateEntity::getPumpCode, pumpEntity.getPumpCode())
|
|
|
.eq(BusReceiveRecordUpdateEntity::getHospitalCode, pumpEntity.getHospitalCode())
|
|
|
.eq(BusReceiveRecordUpdateEntity::getPatientCode, pumpEntity.getPatientCode())
|
|
|
.orderByDesc(BusReceiveRecordUpdateEntity::getGmtModified).last("limit 1"));
|
|
|
-
|
|
|
+ //处理 输注类型小数点后一位
|
|
|
// 2. 转换为Map并应用配置
|
|
|
Map<String, Object> pumpEntityMap = beanToMapWithInclude(pumpEntity, MD5_FIELDS);
|
|
|
//将pumpEntity转为Map 为了加密校验做准备
|
|
|
@@ -93,12 +108,17 @@ public class BusReceiveRecordUpdateImpl extends ServiceImpl<BusReceiveRecordUpda
|
|
|
public static Map<String, Object> beanToMapWithInclude(Object bean, String... includeFields) {
|
|
|
Map<String, Object> fullMap = BeanUtil.beanToMap(bean);
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
- for (Map.Entry<String, Object> entry : fullMap.entrySet()) {
|
|
|
- boolean exists = Arrays.asList(includeFields).contains(entry.getKey());
|
|
|
+ fullMap.forEach((key, value) -> {
|
|
|
+ boolean exists = Arrays.asList(includeFields).contains(key);
|
|
|
if (exists) {
|
|
|
- resultMap.put(entry.getKey(), entry.getValue());
|
|
|
+ if (value instanceof BigDecimal ) {
|
|
|
+ BigDecimal value1 = (BigDecimal) value;
|
|
|
+ resultMap.put(key, value1.setScale(1, RoundingMode.HALF_UP));
|
|
|
+ } else {
|
|
|
+ resultMap.put(key, value);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+ });
|
|
|
return resultMap;
|
|
|
}
|
|
|
}
|