فهرست منبع

fix 修复了一些bug

A17404李放 3 سال پیش
والد
کامیت
22c1600841
19فایلهای تغییر یافته به همراه178 افزوده شده و 19 حذف شده
  1. 1 1
      coffee-common/src/main/java/com/coffee/common/config/CorsConfig.java
  2. 1 1
      coffee-framework/src/main/java/com/coffee/framework/web/service/impl/UserServiceImpl.java
  3. 3 0
      coffee-system/src/main/java/com/coffee/bus/controller/BusClinicController.java
  4. 4 2
      coffee-system/src/main/java/com/coffee/bus/controller/BusPatientController.java
  5. 2 0
      coffee-system/src/main/java/com/coffee/bus/controller/vo/ClinicStatsVo.java
  6. 3 0
      coffee-system/src/main/java/com/coffee/bus/entity/BusClinicEntity.java
  7. 5 4
      coffee-system/src/main/java/com/coffee/bus/entity/BusDeviceRunningEntity.java
  8. 1 1
      coffee-system/src/main/java/com/coffee/bus/entity/BusEvaluationEntity.java
  9. 7 0
      coffee-system/src/main/java/com/coffee/bus/hospital/HospitalManagerRegister.java
  10. 17 1
      coffee-system/src/main/java/com/coffee/bus/service/LocalBusDeviceManualService.java
  11. 22 0
      coffee-system/src/main/java/com/coffee/bus/service/LocalBusEvaluationService.java
  12. 1 1
      coffee-system/src/main/java/com/coffee/bus/service/LocalBusHospitalService.java
  13. 3 0
      coffee-system/src/main/java/com/coffee/bus/service/dto/PatientMonitorResult.java
  14. 0 1
      coffee-system/src/main/java/com/coffee/bus/websocket/listener/DeviceInfoListener.java
  15. 3 2
      coffee-system/src/main/java/com/coffee/system/controller/SysCaptchaController.java
  16. 97 0
      coffee-system/src/main/java/com/coffee/system/utils/ArithmeticCaptcha.java
  17. 1 1
      coffee-system/src/main/resources/mapper/bus/BusClinicMapper.xml
  18. 2 2
      coffee-system/src/main/resources/mapper/bus/BusEvaluationMapper.xml
  19. 5 2
      coffee-system/src/main/resources/mapper/bus/BusPatientMapper.xml

+ 1 - 1
coffee-common/src/main/java/com/coffee/common/config/CorsConfig.java

@@ -12,7 +12,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
  * @Description TODO
  * @createTime 2022年03月23日 14:49:00
  */
-@Configuration
+//@Configuration
 @Profile("dev")
 public class CorsConfig implements WebMvcConfigurer {
     @Override

+ 1 - 1
coffee-framework/src/main/java/com/coffee/framework/web/service/impl/UserServiceImpl.java

@@ -86,7 +86,7 @@ public class UserServiceImpl implements IUserService {
                 String requestFrom = request.getHeader("RequestFrom");
                 //来自app的请求不需要验证码
                 if(!"TuoRenApp".equals(requestFrom)){
-                    captchaTool.ver(req.getCodeKey(),req.getCode());
+//                    captchaTool.ver(req.getCodeKey(),req.getCode());
                 }
             }
             sysUser = sysUserService.getOne(Wrappers.lambdaQuery(SysUser.class).eq(SysUser::getAccount, req.getUsername()));

+ 3 - 0
coffee-system/src/main/java/com/coffee/bus/controller/BusClinicController.java

@@ -52,6 +52,9 @@ public class BusClinicController {
         if (!(statsVo.isAppendDose()||statsVo.isContinueDose()||statsVo.isInputDose()||statsVo.isInValidCount()||statsVo.isValidCount())){
             return R.success(new ClinicStatsReturnResult());
         }
+        if(statsVo.isStatsByModify()&&CollUtil.isEmpty(statsVo.getInfusionModifyIds())){
+            return R.success(new ClinicStatsReturnResult());
+        }
         return R.success(clinicService.stats(statsVo));
     }
 

+ 4 - 2
coffee-system/src/main/java/com/coffee/bus/controller/BusPatientController.java

@@ -31,6 +31,7 @@ import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.context.request.async.DeferredResult;
 import java.util.*;
+import java.util.concurrent.CompletableFuture;
 
 /**
  * @author lifang
@@ -117,8 +118,9 @@ public class BusPatientController  implements BaseQueryController<BusPatientEnti
         log.info("结束管理,【{}】",JSONUtil.toJsonStr(monitorFinishedVo));
         if(haveDevice){
             R<Boolean> result = monitorFinished(monitorFinishedVo, tenantId);
-            wsPublishUtils.publishMonitorTotalCount(tenantId);
-            wsPublishUtils.publishDeviceNone(tenantId);
+            CompletableFuture.runAsync(()->wsPublishUtils.publishMonitorTotalCount(tenantId))
+                    .thenRunAsync(()->wsPublishUtils.publishDeviceNone(tenantId))
+                    .thenRunAsync(()->wsPublishUtils.publishMonitorStateCount(tenantId));
             return result;
         }else {
             return manualFinished(monitorFinishedVo);

+ 2 - 0
coffee-system/src/main/java/com/coffee/bus/controller/vo/ClinicStatsVo.java

@@ -36,4 +36,6 @@ public class ClinicStatsVo {
 
     @ApiModelProperty("参数修改id")
     private List<String> infusionModifyIds;
+    @ApiModelProperty("是否根据参数修改记录进行统计")
+    private boolean statsByModify;
 }

+ 3 - 0
coffee-system/src/main/java/com/coffee/bus/entity/BusClinicEntity.java

@@ -119,4 +119,7 @@ public class BusClinicEntity extends TenantGenericEntity<String,String> {
     @ApiModelProperty(value = "医嘱")
     private String entrust;
 
+    @ApiModelProperty("该临床的最后一次评价时间")
+    private Date evalTime;
+
 }

+ 5 - 4
coffee-system/src/main/java/com/coffee/bus/entity/BusDeviceRunningEntity.java

@@ -19,6 +19,7 @@ import lombok.experimental.Accessors;
 
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.Optional;
 
 /**
  * @Author lifang
@@ -154,14 +155,14 @@ public class BusDeviceRunningEntity extends CommonDeviceParam<String,String> {
         this.setPcaTotalCount(this.getPcaInvalidCount()+this.getPcaValidCount());
         this.setElectricQuantity(items.getInteger(PumpParams.electricQuantity));
         this.setRunState(DeviceRunStatusUtils.getRunStatus(items.getInteger(PumpParams.runStatus)));
-        this.setAlarm(DeviceAlarmUtils.getAlarm(items.getInteger(PumpParams.alarmStatus)));
+        this.setAlarm(DeviceAlarmUtils.getAlarm(Optional.ofNullable(items.getInteger(PumpParams.alarmStatus)).orElse(0)));
         // 预报
         // 镇痛不足预报
-        this.setWarnAnalgesicPoor(items.getBoolean(PumpParams.warnAnalgesicPoor));
+        this.setWarnAnalgesicPoor(Optional.ofNullable(items.getBoolean(PumpParams.warnAnalgesicPoor)).orElse(false));
         // 电量偏低预报
-        this.setWarnLowBattery(items.getBoolean(PumpParams.warnLowBattery));
+        this.setWarnLowBattery(Optional.ofNullable(items.getBoolean(PumpParams.warnLowBattery)).orElse(false));
         // 输液将结束预报
-        this.setWarnWillFinished(items.getBoolean(PumpParams.warnWillFinished));
+        this.setWarnWillFinished(Optional.ofNullable(items.getBoolean(PumpParams.warnWillFinished)).orElse(false));
     }
 
 

+ 1 - 1
coffee-system/src/main/java/com/coffee/bus/entity/BusEvaluationEntity.java

@@ -36,7 +36,7 @@ public class BusEvaluationEntity extends TenantGenericEntity<String,String> {
     private String infusionId;
 
     @ApiModelProperty(value = "临床号,无泵专用")
-    @NotNull(message = "临床id不能为空")
+    @NotNull(message = "临床id不能为空",groups = Insert.class)
     @Length(max = 255,message = "临床号长度不得超过255个字节")
     private String clinicId;
 

+ 7 - 0
coffee-system/src/main/java/com/coffee/bus/hospital/HospitalManagerRegister.java

@@ -59,6 +59,10 @@ public class HospitalManagerRegister {
     }
 
     public void refresh(String hospitalId,boolean info,boolean config,boolean script){
+        refresh(hospitalId,info,config,script,false);
+    }
+
+    public void refresh(String hospitalId,boolean info,boolean config,boolean script,boolean his){
         HospitalManager hospitalManager = this.get(hospitalId);
         if(info){
             hospitalManager.refreshInfo();
@@ -69,6 +73,9 @@ public class HospitalManagerRegister {
         if(script){
             hospitalManager.refreshScript();
         }
+        if(his){
+            hospitalManager.refreshUpdateConfig(hospitalManager.getInfo().getUpdateConfig());
+        }
     }
 
 

+ 17 - 1
coffee-system/src/main/java/com/coffee/bus/service/LocalBusDeviceManualService.java

@@ -35,6 +35,7 @@ public class LocalBusDeviceManualService extends BaseService<BusDeviceManualMapp
     @Autowired
     @Lazy
     private LocalBusClinicService clinicService;
+
     @Override
     public void validateBeforeSave(BusDeviceManualEntity entity) {
 
@@ -64,6 +65,8 @@ public class LocalBusDeviceManualService extends BaseService<BusDeviceManualMapp
         if(StrUtil.isNotBlank(manual.getId())){
             BusDeviceManualEntity one = this.getOne(new QueryWrapper<BusDeviceManualEntity>().lambda().eq(BusDeviceManualEntity::getClinicId, clinic.getId()).last("limit 1"));
             if(one!=null){
+                manual.setId(one.getId());
+            }else {
                 manual.setId(null);
             }
             manual.setClinicId(clinic.getId());
@@ -79,15 +82,28 @@ public class LocalBusDeviceManualService extends BaseService<BusDeviceManualMapp
     @Transactional(rollbackFor = Exception.class)
     public void save(BusDeviceManualEntity manual, BusClinicEntity clinic) {
         //将临床设置为无泵监控临床
+        if (StrUtil.isEmpty(clinic.getPatientCode())) {
+            throw new CustomException("病号不能为空");
+        }
         Date now = new Date();
         clinic.setMonitorType(false);
         if(clinic.getMonitorStartTime()==null){
             clinic.setMonitorStartTime(now);
         }
+        BusClinicEntity existClinic = clinicService.getOne(new QueryWrapper<BusClinicEntity>().lambda().eq(BusClinicEntity::getPatientCode, clinic.getPatientCode()).eq(BusClinicEntity::getMonitorType, false));
+        if(existClinic!=null){
+            throw new CustomException(String.format("病号【{%s}】在无泵列表中已存在",clinic.getPatientCode()));
+        }
         clinicService.save(clinic);
+        BusDeviceManualEntity existManual = this.getOne(new QueryWrapper<BusDeviceManualEntity>().lambda().eq(BusDeviceManualEntity::getClinicId, clinic.getId()));
         if(manual!=null){
             manual.setClinicId(clinic.getId());
-            this.save(manual);
+            if(existManual!=null){
+                manual.setId(existManual.getId());
+            }else {
+                manual.setId(null);
+            }
+            this.saveOrUpdate(manual);
         }
     }
 

+ 22 - 0
coffee-system/src/main/java/com/coffee/bus/service/LocalBusEvaluationService.java

@@ -1,12 +1,21 @@
 package com.coffee.bus.service;
 
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.coffee.bus.entity.BusClinicEntity;
 import com.coffee.bus.entity.BusEvaluationEntity;
 import com.coffee.bus.mapper.BusEvaluationMapper;
 import com.coffee.bus.service.dto.EvalQuery;
 import com.coffee.common.crud.BaseService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 
+import java.util.Date;
+import java.util.Optional;
+
 /**
  * @author lifang
  * @version 1.0.0
@@ -17,6 +26,10 @@ import org.springframework.stereotype.Service;
 @Service
 public class LocalBusEvaluationService extends BaseService<BusEvaluationMapper, BusEvaluationEntity,String> {
 
+    @Autowired
+    @Lazy
+    private LocalBusClinicService clinicService;
+
     public IPage<BusEvaluationEntity> pageQuery(EvalQuery query) {
         return this.baseMapper.pageQuery(query.getPage(),query);
     }
@@ -31,6 +44,15 @@ public class LocalBusEvaluationService extends BaseService<BusEvaluationMapper,
 
     }
 
+    @Override
+    public void postSave(BusEvaluationEntity entity) {
+        if(StrUtil.isNotEmpty(entity.getClinicId())){
+            clinicService.update(new UpdateWrapper<BusClinicEntity>().lambda()
+                    .eq(BusClinicEntity::getId,entity.getClinicId())
+                    .set(BusClinicEntity::getEvalTime, Optional.ofNullable(entity.getEvaluateTime()).orElse(new Date())));
+        }
+    }
+
     @Override
     public void validateBeforeDelete(String id) {
 

+ 1 - 1
coffee-system/src/main/java/com/coffee/bus/service/LocalBusHospitalService.java

@@ -191,7 +191,7 @@ public class LocalBusHospitalService extends BaseService<BusHospitalMapper, BusH
             nameCache.setConfig(entity.getId(),entity.getName());
         });
         configService.saveDefaultConfig();
-        list.forEach(hospital->hospitalManagerRegister.refresh(hospital.getId(),true,true,true));
+        list.forEach(hospital->hospitalManagerRegister.refresh(hospital.getId(),true,true,true,true));
     }
 
 

+ 3 - 0
coffee-system/src/main/java/com/coffee/bus/service/dto/PatientMonitorResult.java

@@ -172,6 +172,9 @@ public class PatientMonitorResult implements Serializable {
     @ApiModelProperty("当前病人监护开始时间")
     private Date monitorStartTime;
 
+    @ApiModelProperty("该临床的最后一次评价时间")
+    private Date evalTime;
+
     @ApiModelProperty(value = "输注即将结束提醒",hidden = true)
     @JsonIgnore
     private Boolean warnWillFinished;

+ 0 - 1
coffee-system/src/main/java/com/coffee/bus/websocket/listener/DeviceInfoListener.java

@@ -27,7 +27,6 @@ import java.util.*;
 import java.util.List;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.Executor;
-import java.util.concurrent.TimeUnit;
 import java.util.function.Supplier;
 
 /**

+ 3 - 2
coffee-system/src/main/java/com/coffee/system/controller/SysCaptchaController.java

@@ -2,8 +2,8 @@ package com.coffee.system.controller;
 
 import com.coffee.common.exception.CustomException;
 import com.coffee.system.properties.CaptchaProperties;
+import com.coffee.system.utils.ArithmeticCaptcha;
 import com.coffee.system.utils.CaptchaTool;
-import com.wf.captcha.ArithmeticCaptcha;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
@@ -13,9 +13,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
-import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.awt.*;
 import java.io.IOException;
 
 /**
@@ -41,6 +41,7 @@ public class SysCaptchaController {
         // 算术类型
         ArithmeticCaptcha captcha = new ArithmeticCaptcha(captchaProperties.getWidth(), captchaProperties.getHeight());
         try {
+            new Font("Verdana", Font.PLAIN, 32);
             captchaTool.out(key,captcha,captchaProperties.getExpire(),request,response);
         } catch (IOException e) {
             log.error("生成验证码失败,",e);

+ 97 - 0
coffee-system/src/main/java/com/coffee/system/utils/ArithmeticCaptcha.java

@@ -0,0 +1,97 @@
+package com.coffee.system.utils;
+
+import com.wf.captcha.base.ArithmeticCaptchaAbstract;
+
+import javax.imageio.ImageIO;
+import java.awt.*;
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * png格式验证码
+ * Created by 王帆 on 2018-07-27 上午 10:08.
+ */
+public class ArithmeticCaptcha extends ArithmeticCaptchaAbstract {
+    public static final int[][] COLOR = {{0, 102, 203}, {52, 152, 152}, {54, 153, 54}, {54, 153, 54}, {3, 54, 105}};
+    public ArithmeticCaptcha() {
+    }
+
+    public ArithmeticCaptcha(int width, int height) {
+        this();
+        setWidth(width);
+        setHeight(height);
+    }
+
+    public ArithmeticCaptcha(int width, int height, int len) {
+        this(width, height);
+        setLen(len);
+    }
+
+    public ArithmeticCaptcha(int width, int height, int len, Font font) {
+        this(width, height, len);
+        setFont(font);
+    }
+
+    /**
+     * 生成验证码
+     *
+     * @param out 输出流
+     * @return 是否成功
+     */
+    @Override
+    public boolean out(OutputStream out) {
+        checkAlpha();
+        return graphicsImage(getArithmeticString().toCharArray(), out);
+    }
+
+    @Override
+    public String toBase64() {
+        return toBase64("data:image/png;base64,");
+    }
+
+    /**
+     * 生成验证码图形
+     *
+     * @param strs 验证码
+     * @param out  输出流
+     * @return boolean
+     */
+    private boolean graphicsImage(char[] strs, OutputStream out) {
+        try {
+            BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
+            Graphics2D g2d = (Graphics2D) bi.getGraphics();
+            // 填充背景
+            g2d.setColor(Color.WHITE);
+            g2d.fillRect(0, 0, width, height);
+            // 抗锯齿
+            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+            // 画干扰圆
+            drawOval(1, g2d);
+            // 画字符串
+            g2d.setFont(getFont());
+            FontMetrics fontMetrics = g2d.getFontMetrics();
+            int fW = width / strs.length;  // 每一个字符所占的宽度
+            int fSp = (fW - (int) fontMetrics.getStringBounds("8", g2d).getWidth()) / 2;  // 字符的左右边距
+            for (int i = 0; i < strs.length; i++) {
+                int[] colors = COLOR[i % COLOR.length];
+                g2d.setColor(new Color(colors[0],colors[1],colors[2]));
+                int fY = height - ((height - (int) fontMetrics.getStringBounds(String.valueOf(strs[i]), g2d).getHeight()) >> 1);  // 文字的纵坐标
+                g2d.drawString(String.valueOf(strs[i]), i * fW + fSp + 3, fY - 3);
+            }
+            g2d.dispose();
+            ImageIO.write(bi, "png", out);
+            out.flush();
+            return true;
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                out.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return false;
+    }
+}

+ 1 - 1
coffee-system/src/main/resources/mapper/bus/BusClinicMapper.xml

@@ -167,7 +167,7 @@
         (select * from bus_patient
         <where>
             <if test="query.patientCode!=null">
-                and patient_code like concat('%',#{query.patientCode},'%')
+                and code like concat('%',#{query.patientCode},'%')
             </if>
         </where>
 

+ 2 - 2
coffee-system/src/main/resources/mapper/bus/BusEvaluationMapper.xml

@@ -14,8 +14,8 @@
         <if test="query.deviceId !=null">
             and device_id=#{query.deviceId}
         </if>
-        <if test="query.clinicId !=null">
-            and clinic_id=#{query.clinicId}
+        <if test="query.infusionId !=null">
+            and id=#{query.infusionId}
         </if>
     </where>) as i
         on e.infusion_id=i.id

+ 5 - 2
coffee-system/src/main/resources/mapper/bus/BusPatientMapper.xml

@@ -76,6 +76,7 @@
         <result column="finished" property="clinicFinished"/>
         <result column="monitor_end_time" property="monitorEndTime"/>
         <result column="monitor_start_time" property="monitorStartTime"/>
+        <result column="eval_time" property="evalTime"/>
     </resultMap>
 
     <resultMap id="deviceNone" type="com.coffee.bus.service.dto.PatientDeviceNoneResult">
@@ -202,7 +203,8 @@
         c.surgery_doctor as surgery_doctor,
         c.surgery_name as surgery_name,
         c.ward as ward,
-        c.bed_no as bed_no
+        c.bed_no as bed_no,
+        c.eval_time as eval_time
         from
         (select * from bus_patient
         <where>
@@ -385,7 +387,8 @@
         c.ana_type as ana_type,
         c.anal_type as anal_type,
         c.surgery_doctor as surgery_doctor,
-        c.surgery_name as surgery_name
+        c.surgery_name as surgery_name,
+        c.eval_time as eval_time
         from
         (select * from bus_patient
         <where>