Bläddra i källkod

add 医院功能配置
update 全局配置 boolean->int

18339543638 3 år sedan
förälder
incheckning
d9a7ce0d99
27 ändrade filer med 503 tillägg och 121 borttagningar
  1. 32 0
      coffee-common/src/main/java/com/coffee/common/config/BooleanToIntegerSerializer.java
  2. 0 54
      coffee-common/src/main/java/com/coffee/common/config/JacksonConfig.java
  3. 0 14
      coffee-framework/src/main/java/com/coffee/framework/config/SwaggerConfig.java
  4. 12 5
      coffee-framework/src/main/java/com/coffee/framework/config/WebAppMvcConfig.java
  5. 11 0
      coffee-system/src/main/java/com/coffee/bus/bean/config/Config.java
  6. 97 0
      coffee-system/src/main/java/com/coffee/bus/bean/config/EvalConfig.java
  7. 55 0
      coffee-system/src/main/java/com/coffee/bus/bean/config/OtherConfig.java
  8. 62 0
      coffee-system/src/main/java/com/coffee/bus/bean/config/UndoConfig.java
  9. 3 3
      coffee-system/src/main/java/com/coffee/bus/controller/BusDeviceRunningController.java
  10. 69 0
      coffee-system/src/main/java/com/coffee/bus/controller/BusHospitalConfigController.java
  11. 3 3
      coffee-system/src/main/java/com/coffee/bus/controller/vo/ManualUndoConfig.java
  12. 3 7
      coffee-system/src/main/java/com/coffee/bus/entity/BusDeviceAlarmEntity.java
  13. 1 1
      coffee-system/src/main/java/com/coffee/bus/entity/BusDeviceEntity.java
  14. 2 2
      coffee-system/src/main/java/com/coffee/bus/entity/BusDeviceHistoryEntity.java
  15. 2 2
      coffee-system/src/main/java/com/coffee/bus/entity/BusDeviceRunningEntity.java
  16. 1 2
      coffee-system/src/main/java/com/coffee/bus/entity/BusEvaluationEntity.java
  17. 52 0
      coffee-system/src/main/java/com/coffee/bus/entity/BusHospitalConfigEntity.java
  18. 0 4
      coffee-system/src/main/java/com/coffee/bus/entity/BusHospitalEntity.java
  19. 26 0
      coffee-system/src/main/java/com/coffee/bus/enums/ConfigEnum.java
  20. 17 0
      coffee-system/src/main/java/com/coffee/bus/mapper/BusHospitalConfigMapper.java
  21. 1 1
      coffee-system/src/main/java/com/coffee/bus/registry/device/ClusterDeviceRegistry.java
  22. 8 8
      coffee-system/src/main/java/com/coffee/bus/service/LocalBusDeviceRunningService.java
  23. 1 1
      coffee-system/src/main/java/com/coffee/bus/service/LocalBusDeviceService.java
  24. 31 0
      coffee-system/src/main/java/com/coffee/bus/service/LocalBusHospitalConfigService.java
  25. 2 2
      coffee-system/src/main/java/com/coffee/bus/service/LocalBusPatientService.java
  26. 1 1
      coffee-system/src/main/java/com/coffee/bus/websocket/listener/DeviceAlarmListener.java
  27. 11 11
      coffee-system/src/main/java/com/coffee/bus/websocket/listener/DeviceInfoListener.java

+ 32 - 0
coffee-common/src/main/java/com/coffee/common/config/BooleanToIntegerSerializer.java

@@ -0,0 +1,32 @@
+package com.coffee.common.config;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.databind.JsonSerializer;
+import com.fasterxml.jackson.databind.SerializerProvider;
+
+import java.io.IOException;
+import java.util.Objects;
+
+/**
+ * 布尔类型序列化  false=0,true=1
+ * <p>
+ * 作用描述:
+ *
+ * @author jyusun
+ * @date 2021/12/1 15:50
+ * @since 1.0.0
+ */
+public class BooleanToIntegerSerializer extends JsonSerializer<Boolean> {
+
+    @Override
+    public void serialize(Boolean obj, JsonGenerator gen, SerializerProvider serializers) throws IOException {
+        Integer value=null;
+
+        if (Objects.isNull(obj)) {
+            return ;
+        } else {
+            value = Boolean.parseBoolean(String.valueOf(obj)) ? 1 : 0;
+        }
+        gen.writeObject(value);
+    }
+}

+ 0 - 54
coffee-common/src/main/java/com/coffee/common/config/JacksonConfig.java

@@ -1,54 +0,0 @@
-package com.coffee.common.config;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
-import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
-import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
-import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
-import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
-import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
-import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.Ordered;
-import org.springframework.core.annotation.Order;
-import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
-
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.time.format.DateTimeFormatter;
-import java.util.Date;
-
-@Configuration
-public class JacksonConfig {
-
-    @Bean
-    @Order(Ordered.HIGHEST_PRECEDENCE)
-    public Jackson2ObjectMapperBuilderCustomizer customJackson() {
-        return new Jackson2ObjectMapperBuilderCustomizer() {
-            @Override
-            public void customize(Jackson2ObjectMapperBuilder builder) {
-                builder.serializerByType(LocalDateTime.class,
-                        new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-                builder.serializerByType(LocalDate.class,
-                        new LocalDateSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-                builder.serializerByType(LocalTime.class,
-                        new LocalTimeSerializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
-                builder.deserializerByType(LocalDateTime.class,
-                        new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-                builder.deserializerByType(Date.class,
-                        new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-                builder.deserializerByType(LocalDate.class,
-                        new LocalDateDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-                builder.deserializerByType(LocalTime.class,
-                        new LocalTimeDeserializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
-                builder.serializationInclusion(JsonInclude.Include.NON_NULL);
-                builder.failOnUnknownProperties(false);
-//                builder.featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
-                builder.featuresToDisable(SerializationFeature.WRITE_DATE_KEYS_AS_TIMESTAMPS);
-            }
-        };
-    }
-}

+ 0 - 14
coffee-framework/src/main/java/com/coffee/framework/config/SwaggerConfig.java

@@ -22,7 +22,6 @@ import java.util.*;
 @Configuration
 @EnableKnife4j
 @EnableSwagger2WebMvc
-//@EnableSwagger2
 public class SwaggerConfig implements WebMvcConfigurer {
 
     public static final String VERSION = "1.0.0";
@@ -82,19 +81,6 @@ public class SwaggerConfig implements WebMvcConfigurer {
                 .enable(true);
     }
 
-    @Bean
-    public Docket test(){
-        return new Docket(DocumentationType.SWAGGER_2)
-                .select()
-                .apis(RequestHandlerSelectors.basePackage("com.coffee.framework.test.controller"))
-                .paths(PathSelectors.any())
-                .build()
-                .groupName("测试模块")
-                .apiInfo(apiInfo())
-                .securitySchemes(security())
-                .securityContexts(securityContexts())
-                .enable(true);
-    }
     private List<SecurityScheme> security() {
         return Arrays.asList(new ApiKey("BASE_TOKEN", "Authorization",   In.HEADER.toValue()));
     }

+ 12 - 5
coffee-framework/src/main/java/com/coffee/framework/config/WebAppMvcConfig.java

@@ -1,5 +1,6 @@
 package com.coffee.framework.config;
 
+import com.coffee.common.config.BooleanToIntegerSerializer;
 import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.module.SimpleModule;
@@ -21,20 +22,26 @@ import java.util.*;
  * @Created by jianxiapc
  */
 @Configuration
-@Profile("dev")
+//@Profile("dev")
 public class WebAppMvcConfig implements WebMvcConfigurer {
     @Override
     public void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
         MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
         ObjectMapper objectMapper = converter.getObjectMapper();
         // 生成JSON时,将所有Long转换成String
-        SimpleModule simpleModule = new SimpleModule();
-        simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
-        simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
-        objectMapper.registerModule(simpleModule);
+        SimpleModule dateSimpleModule = new SimpleModule();
+        dateSimpleModule.addSerializer(Long.class, ToStringSerializer.instance);
+        dateSimpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
+
+        objectMapper.registerModule(dateSimpleModule);
         // 时间格式化
         objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
         objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
+
+        SimpleModule booleanSimpleModule = new SimpleModule();
+        booleanSimpleModule.addSerializer(Boolean.class, new BooleanToIntegerSerializer());
+        booleanSimpleModule.addSerializer(Boolean.TYPE, new BooleanToIntegerSerializer());
+        objectMapper.registerModule(booleanSimpleModule);
         // 设置格式化内容
         converter.setObjectMapper(objectMapper);
         converters.add(0, converter);

+ 11 - 0
coffee-system/src/main/java/com/coffee/bus/bean/config/Config.java

@@ -0,0 +1,11 @@
+package com.coffee.bus.bean.config;
+
+/**
+ * @author lifang
+ * @version 1.0.0
+ * @ClassName Config.java
+ * @Description TODO
+ * @createTime 2022年04月12日 11:14:00
+ */
+public abstract class Config {
+}

+ 97 - 0
coffee-system/src/main/java/com/coffee/bus/bean/config/EvalConfig.java

@@ -0,0 +1,97 @@
+package com.coffee.bus.bean.config;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @author lifang
+ * @version 1.0.0
+ * @ClassName EvalConfig.java
+ * @Description 医院评价设置
+ * @createTime 2022年04月12日 10:17:00
+ */
+@Data
+@ApiModel("医院功能配置--评价设置")
+public class EvalConfig extends Config{
+
+    @ApiModelProperty(value = "评价提醒时间")
+    private Integer remindTime;
+
+    @ApiModelProperty(value = "已评价提醒间隔")
+    private Integer interval;
+
+    @ApiModelProperty(value = "疼痛评分静止")
+    private  Boolean statics;
+
+    @ApiModelProperty(value = "疼痛评分活动")
+    private  Boolean activity;
+
+    @ApiModelProperty(value = "镇静评分")
+    private  Boolean calm;
+
+    @ApiModelProperty(value = "左上肢")
+    private  Boolean leftArm;
+
+    @ApiModelProperty(value = "左下肢")
+    private  Boolean leftLeg;
+
+    @ApiModelProperty(value = "右上肢")
+    private  Boolean rightArm;
+
+    @ApiModelProperty(value = "右下肢")
+    private  Boolean rightLeg;
+
+    @ApiModelProperty(value = "恶心呕吐")
+    private  Boolean nauseaVomit;
+
+    @ApiModelProperty(value = "瘙痒")
+    private  Boolean itch;
+
+    @ApiModelProperty(value = "眩晕")
+    private  Boolean vertigo;
+
+    @ApiModelProperty(value = "咽喉疼痛")
+    private  Boolean soreThroat;
+
+    @ApiModelProperty(value = "尿潴留")
+    private  Boolean uroschesis;
+
+    @ApiModelProperty(value = "呼吸抑制")
+    private  Boolean breathDepression;
+
+    @ApiModelProperty(value = "声音嘶哑")
+    private  Boolean hoarseness;
+
+    @ApiModelProperty(value = "认知障碍")
+    private  Boolean cognitionObstacle;
+
+    @ApiModelProperty(value = "其他")
+    private  Boolean other;
+
+    @ApiModelProperty(value = "满意度")
+    private  Boolean satisfaction;
+
+
+    @ApiModelProperty(value = "评价时间",hidden = true)
+    private  Boolean evaluateTime;
+
+    @ApiModelProperty(value = "评价人")
+    private  Boolean evaluator;
+
+    @ApiModelProperty(value = "收缩压")
+    private  Boolean  shrinkPressure;
+
+
+    @ApiModelProperty(value = "舒张压")
+    private  Boolean  diastolicPressure;
+
+    @ApiModelProperty(value = "心率")
+    private  Boolean heartRate;
+
+    @ApiModelProperty(value = "呼吸频率")
+    private  Boolean breathRate;
+
+    @ApiModelProperty(value = "血氧饱和度")
+    private  Boolean bloodOxygenSaturation;
+}

+ 55 - 0
coffee-system/src/main/java/com/coffee/bus/bean/config/OtherConfig.java

@@ -0,0 +1,55 @@
+package com.coffee.bus.bean.config;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @author lifang
+ * @version 1.0.0
+ * @ClassName OtherConfig.java
+ * @Description TODO
+ * @createTime 2022年04月12日 10:17:00
+ */
+@Data
+@NoArgsConstructor
+@ApiModel("医院功能配置--其他设置")
+public class OtherConfig extends Config{
+
+    @ApiModelProperty("镇痛不足设置")
+    private Anal anal;
+
+    @ApiModelProperty("其他设置")
+    private Other other;
+
+    @Data
+    @NoArgsConstructor
+    @ApiModel("镇痛不足设置")
+    public static class Anal{
+        @ApiModelProperty("镇痛不足时间判定")
+        private Integer insufficientTime;
+        @ApiModelProperty("镇痛不足类型设置")
+        private Boolean valid;
+        @ApiModelProperty("镇痛不足次数设置")
+        private Integer insufficientCount;
+        @ApiModelProperty("镇痛不足提醒消失时间设置")
+        private Integer disappearTime;
+    }
+
+    @Data
+    @NoArgsConstructor
+    @ApiModel("其他设置")
+    public static class Other{
+        /**
+         * 不在服务区设置
+         */
+        @ApiModelProperty("不在服务区设置")
+        private Integer noSignal;
+        /**
+         * 低输注时间设置
+         */
+        @ApiModelProperty("低输注时间设置")
+        private Integer lowInfusion;
+    }
+}

+ 62 - 0
coffee-system/src/main/java/com/coffee/bus/bean/config/UndoConfig.java

@@ -0,0 +1,62 @@
+package com.coffee.bus.bean.config;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @author lifang
+ * @version 1.0.0
+ * @ClassName ManualUndoConfig.java
+ * @Description 医院撤泵设置
+ * @createTime 2022年04月12日 10:17:00
+ */
+@Data
+@ApiModel("医院功能配置--撤泵配置")
+public class UndoConfig extends Config{
+
+    @ApiModelProperty("自动撤泵")
+    private  AutoUndo auto;
+
+    @ApiModelProperty("手动撤泵")
+    private ManualUndo manual;
+    /**
+     * 自动撤泵
+     */
+    @ApiModel("自动撤泵")
+    @Data
+    @NoArgsConstructor
+    public static class AutoUndo{
+        @ApiModelProperty("开始自动撤泵")
+        private Boolean enable;
+        @ApiModelProperty("自动撤泵人类型")
+        private String undoByType;
+        @ApiModelProperty("自动撤泵人姓名")
+        private String undoBy;
+        @ApiModelProperty("关机到撤泵时间")
+        private Integer shutDownInterval;
+        @ApiModelProperty("不在服务区到撤泵时间")
+        private Integer noSignalInterval;
+    }
+
+    /**
+     * 手动撤泵
+     */
+    @ApiModel("手动撤泵")
+    @Data
+    @NoArgsConstructor
+    public static class  ManualUndo{
+        @ApiModelProperty("开启手动撤泵配置")
+        private Boolean enable;
+        @ApiModelProperty("撤泵人为空检测")
+        private Boolean undoByCheck;
+        @ApiModelProperty("销毁人为空检测")
+        private Boolean destroyerCheck;
+        @ApiModelProperty("见证人为空检测")
+        private Boolean witnessesCheck;
+        @ApiModelProperty("不在服务区撤泵时间")
+        private Boolean undoTime;
+
+    }
+}

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

@@ -4,8 +4,8 @@ import cn.dev33.satoken.SaManager;
 import cn.dev33.satoken.annotation.SaCheckPermission;
 import cn.dev33.satoken.stp.StpLogic;
 import com.baomidou.mybatisplus.core.mapper.Mapper;
+import com.coffee.bus.controller.vo.ManualUndoConfig;
 import com.coffee.bus.controller.vo.NoPumpConfig;
-import com.coffee.bus.controller.vo.UndoConfig;
 import com.coffee.bus.entity.BusDeviceRunningEntity;
 import com.coffee.bus.enums.DeviceStatusEnum;
 import com.coffee.bus.service.LocalBusDeviceRunningService;
@@ -41,8 +41,8 @@ public class BusDeviceRunningController implements BaseQueryController<BusDevice
     @PostMapping("/undo")
     @SaCheckPermission("bus:device:undo")
     @ApiOperation(value = "进行撤泵操作,权限为bus:pump:undo")
-    public R undo(@RequestBody UndoConfig undoConfig){
-        netPumpService.undo(undoConfig);
+    public R undo(@RequestBody ManualUndoConfig manualUndoConfig){
+        netPumpService.undo(manualUndoConfig);
         return R.success();
     }
 

+ 69 - 0
coffee-system/src/main/java/com/coffee/bus/controller/BusHospitalConfigController.java

@@ -0,0 +1,69 @@
+package com.coffee.bus.controller;
+
+import com.baomidou.mybatisplus.core.mapper.Mapper;
+import com.coffee.bus.bean.config.EvalConfig;
+import com.coffee.bus.bean.config.OtherConfig;
+import com.coffee.bus.bean.config.UndoConfig;
+import com.coffee.bus.entity.BusHospitalConfigEntity;
+import com.coffee.bus.service.LocalBusHospitalConfigService;
+import com.coffee.common.crud.BaseService;
+import com.coffee.common.crud.controller.BaseCrudController;
+import com.coffee.common.result.R;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author lifang
+ * @version 1.0.0
+ * @ClassName BusHospitalController.java
+ * @Description TODO
+ * @createTime 2022年03月19日 09:28:00
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/bus/hospital/config")
+@Api(tags = "医院功能配置",value = "统一权限前缀(hospital:config),hospital:config:add")
+public class BusHospitalConfigController extends BaseCrudController<BusHospitalConfigEntity, String> {
+    private final LocalBusHospitalConfigService hospitalConfigService;
+
+    @PostMapping("/eval")
+    @ApiOperation(value = "",hidden = true)
+    @Deprecated
+    public R evalConfig(@RequestBody EvalConfig evalConfig){
+        return R.success();
+    }
+
+
+    @PostMapping("/other")
+    @ApiOperation(value = "",hidden = true)
+    @Deprecated
+    public R otherConfig(@RequestBody OtherConfig evalConfig){
+        return R.success();
+    }
+
+
+    @PostMapping("/undo")
+    @ApiOperation(value = "",hidden = true)
+    @Deprecated
+    public R undoConfig(@RequestBody UndoConfig evalConfig){
+        return R.success();
+    }
+    /**
+     * 权限控制前缀
+     * @return
+     */
+    @Override
+    public String getPermissionPrefix() {
+        return "hospital:config";
+    }
+
+    @Override
+    public BaseService<? extends Mapper<BusHospitalConfigEntity>, BusHospitalConfigEntity, String> getService() {
+        return hospitalConfigService;
+    }
+}

+ 3 - 3
coffee-system/src/main/java/com/coffee/bus/controller/vo/UndoConfig.java → coffee-system/src/main/java/com/coffee/bus/controller/vo/ManualUndoConfig.java

@@ -7,13 +7,13 @@ import java.util.*;
 /**
  * @author lifang
  * @version 1.0.0
- * @ClassName UndoConfig.java
+ * @ClassName ManualUndoConfig.java
  * @Description TODO
  * @createTime 2022年03月30日 08:31:00
  */
 @Data
-@ApiModel("撤泵配置")
-public class UndoConfig {
+@ApiModel("手动撤泵配置")
+public class ManualUndoConfig {
     private List<String> ids;
     @ApiModelProperty("撤泵人")
     private String undoBy;

+ 3 - 7
coffee-system/src/main/java/com/coffee/bus/entity/BusDeviceAlarmEntity.java

@@ -1,11 +1,9 @@
 package com.coffee.bus.entity;
 
-import cn.hutool.core.lang.Assert;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.coffee.bus.enums.DeviceAlarmEnum;
 import com.coffee.common.config.mybatis.DateToBigIntHandler;
-import com.coffee.common.entity.Entity;
 import com.coffee.common.entity.TenantGenericEntity;
 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 import io.swagger.annotations.ApiModel;
@@ -14,9 +12,7 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.ToString;
 import org.apache.ibatis.type.EnumOrdinalTypeHandler;
-
 import java.util.Date;
-import java.util.function.Predicate;
 
 /**
  * @author lifang
@@ -49,11 +45,11 @@ public class BusDeviceAlarmEntity extends TenantGenericEntity<String,String> {
 
     @ApiModelProperty(value = "报警是否正在进行",hidden = true)
     @JsonIgnoreProperties(allowSetters = true)
-    private Integer doing;
+    private Boolean doing;
 
 
     @ApiModelProperty(value = "是否已处理 0、未处理,1、已处理,暂未使用")
-    private Integer dealing;
+    private Boolean dealing;
 
 
     @ApiModelProperty(value = "报警记录所绑定的历史记录id,后续用于更新操作",hidden = true)
@@ -69,7 +65,7 @@ public class BusDeviceAlarmEntity extends TenantGenericEntity<String,String> {
     @JsonIgnoreProperties(allowSetters = true)
     private String classification;
 
-    public BusDeviceAlarmEntity(String deviceId, DeviceAlarmEnum alarm, Date alarmTime, Integer doing, String deviceHistoryId, String clinicId, String classification) {
+    public BusDeviceAlarmEntity(String deviceId, DeviceAlarmEnum alarm, Date alarmTime, Boolean doing, String deviceHistoryId, String clinicId, String classification) {
         this.deviceId = deviceId;
         this.alarm = alarm;
         this.alarmTime = alarmTime;

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

@@ -49,7 +49,7 @@ public class BusDeviceEntity extends TenantGenericEntity<String,String> {
     private AliIotConfig config;
 
     @ApiModelProperty(value = "是否启用,0、不启用 1、启用 ")
-    private Integer enable;
+    private Boolean enable;
 
     @TableField(fill = FieldFill.INSERT)
     @TableLogic(value = "0",delval = "1")

+ 2 - 2
coffee-system/src/main/java/com/coffee/bus/entity/BusDeviceHistoryEntity.java

@@ -182,8 +182,8 @@ public class BusDeviceHistoryEntity extends TenantGenericEntity<String,String> {
         history.setTotalCount(pump.getPcaTotalCount());
         history.setRunState(pump.getRunState());
         history.setStartTime(pump.getStartTime());
-        history.setMonitorType(pump.getMonitorType());
-        history.setMaster(pump.getMaster());
+//        history.setMonitorType(pump.getMonitorType());
+//        history.setMaster(pump.getMaster());
         return history;
     }
 }

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

@@ -192,11 +192,11 @@ public class BusDeviceRunningEntity extends TenantGenericEntity<String,String> {
 
     @ApiModelProperty(value = "监护类型,1、有泵监护 0、无泵监护")
     @JsonIgnoreProperties(allowSetters = true)
-    private Integer monitorType;
+    private Boolean monitorType;
 
     @ApiModelProperty(value = "是否为主泵数据, 0、副泵 1、主泵(即当前临床绑定的泵)")
     @JsonIgnoreProperties(allowSetters = true)
-    private Integer master;
+    private Boolean master;
 
     @ApiModelProperty(value = "分包标记位",readOnly = true)
     @JsonIgnoreProperties(allowSetters = true)

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

@@ -106,7 +106,6 @@ public class BusEvaluationEntity extends TenantGenericEntity<String,String> {
 
     @ApiModelProperty(value = "评价时间",hidden = true)
     @TableField(typeHandler = DateToBigIntHandler.class)
-    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
     private Date evaluateTime;
 
     @ApiModelProperty(value = "评价人")
@@ -118,7 +117,7 @@ public class BusEvaluationEntity extends TenantGenericEntity<String,String> {
 
 
     @ApiModelProperty(value = "舒张压")
-    private String  diastensPressure;
+    private String  diastolicPressure;
 
     @ApiModelProperty(value = "心率")
     private String heartRate;

+ 52 - 0
coffee-system/src/main/java/com/coffee/bus/entity/BusHospitalConfigEntity.java

@@ -0,0 +1,52 @@
+package com.coffee.bus.entity;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
+import com.coffee.bus.enums.ConfigEnum;
+import com.coffee.common.config.mybatis.DateToBigIntHandler;
+import com.coffee.common.entity.RecordCreationEntity;
+import com.coffee.common.entity.RecordModifierEntity;
+import com.coffee.common.entity.TenantGenericEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.apache.ibatis.type.EnumOrdinalTypeHandler;
+
+import java.util.Date;
+import java.util.Map;
+
+/**
+ * @author lifang
+ * @version 1.0.0
+ * @ClassName BusHospitalConfigEntity.java
+ * @Description TODO
+ * @createTime 2022年04月12日 10:07:00
+ */
+@Data
+@TableName(value = "bus_hospital_config",autoResultMap = true)
+@ApiModel(value="医院配置", description="配置医院的全局参数,如撤泵配置、评价配置等")
+public class BusHospitalConfigEntity extends TenantGenericEntity<String,String> implements RecordModifierEntity, RecordCreationEntity {
+
+
+    @TableField(typeHandler = EnumOrdinalTypeHandler.class,javaType = true)
+    @ApiModelProperty(value = "配置类型",example = "eval:评价配置,other:其他设置,undo:撤泵配置",allowableValues = "eval:评价配置,other:其他设置,undo:撤泵配置")
+    private ConfigEnum type;
+
+    @TableField(typeHandler = FastjsonTypeHandler.class,javaType = true)
+    @ApiModelProperty(value = "配置类型", example= "详情请查看apiModel中:评价配置,其他设置,撤泵配置")
+    private Map<String,Object> config;
+
+    @TableField(fill = FieldFill.INSERT)
+    private String createBy;
+
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private String updateBy;
+
+    @TableField(typeHandler = DateToBigIntHandler.class,fill = FieldFill.INSERT)
+    private Date createTime;
+
+    @TableField(typeHandler = DateToBigIntHandler.class,fill = FieldFill.UPDATE)
+    private Date updateTime;
+}

+ 0 - 4
coffee-system/src/main/java/com/coffee/bus/entity/BusHospitalEntity.java

@@ -4,10 +4,8 @@ import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
 import com.coffee.bus.bean.Script;
 import com.coffee.common.config.mybatis.DateToBigIntHandler;
-import com.coffee.common.entity.GenericEntity;
 import com.coffee.common.entity.RecordCreationEntity;
 import com.coffee.common.entity.RecordModifierEntity;
-import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -79,11 +77,9 @@ public class BusHospitalEntity implements RecordModifierEntity, RecordCreationEn
     private String updateBy;
 
     @TableField(typeHandler = DateToBigIntHandler.class,fill = FieldFill.INSERT)
-    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
     private Date createTime;
 
     @TableField(typeHandler = DateToBigIntHandler.class,fill = FieldFill.UPDATE)
-    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
     private Date updateTime;
 
     @TableField(fill = FieldFill.INSERT)

+ 26 - 0
coffee-system/src/main/java/com/coffee/bus/enums/ConfigEnum.java

@@ -0,0 +1,26 @@
+package com.coffee.bus.enums;
+
+import com.coffee.bus.bean.config.EvalConfig;
+import com.coffee.bus.bean.config.OtherConfig;
+import com.coffee.bus.bean.config.UndoConfig;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @author lifang
+ * @version 1.0.0
+ * @ClassName ConfigEnum.java
+ * @Description TODO
+ * @createTime 2022年04月12日 10:10:00
+ */
+@Getter
+@AllArgsConstructor
+public enum  ConfigEnum {
+    undo(0,"撤泵配置", UndoConfig.class),
+    eval(1,"评价配置", EvalConfig.class),
+    other(2,"其他配置", OtherConfig.class);
+
+    private Integer code;
+    private String text;
+    private Class configClass;
+}

+ 17 - 0
coffee-system/src/main/java/com/coffee/bus/mapper/BusHospitalConfigMapper.java

@@ -0,0 +1,17 @@
+package com.coffee.bus.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.coffee.bus.entity.BusHospitalConfigEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @author lifang
+ * @version 1.0.0
+ * @ClassName BusHospitalMapper.java
+ * @Description 设备注册信息
+ * @createTime 2022年03月19日 09:15:00
+ */
+@Mapper
+public interface BusHospitalConfigMapper extends BaseMapper<BusHospitalConfigEntity> {
+
+}

+ 1 - 1
coffee-system/src/main/java/com/coffee/bus/registry/device/ClusterDeviceRegistry.java

@@ -47,7 +47,7 @@ public class ClusterDeviceRegistry implements DeviceRegistry {
                 //设备不存在,即缓存操作不存在
                 return null;
             }
-            deviceOperator.setEnable(device.getEnable()==1);
+            deviceOperator.setEnable(device.getEnable());
             deviceOperator.setDeviceId(deviceId);
             deviceOperator.setTenantId(device.getTenantId());
             if(pump==null){

+ 8 - 8
coffee-system/src/main/java/com/coffee/bus/service/LocalBusDeviceRunningService.java

@@ -2,7 +2,7 @@ package com.coffee.bus.service;
 
 import cn.hutool.core.collection.CollectionUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.coffee.bus.controller.vo.UndoConfig;
+import com.coffee.bus.controller.vo.ManualUndoConfig;
 import com.coffee.bus.entity.BusClinicEntity;
 import com.coffee.bus.entity.BusDeviceRunningEntity;
 import com.coffee.bus.entity.BusDeviceHistoryEntity;
@@ -55,11 +55,11 @@ public class LocalBusDeviceRunningService extends BaseService<BusDeviceRunningMa
     }
     /**
      * 撤泵操作
-     * @param undoConfig
+     * @param manualUndoConfig
      */
     @Transactional(rollbackFor = Exception.class)
-    public void undo(UndoConfig undoConfig) {
-        List<String> ids = undoConfig.getIds();
+    public void undo(ManualUndoConfig manualUndoConfig) {
+        List<String> ids = manualUndoConfig.getIds();
         if(CollectionUtil.isEmpty(ids)){
             return;
         }
@@ -72,10 +72,10 @@ public class LocalBusDeviceRunningService extends BaseService<BusDeviceRunningMa
         //泵的撤泵数据插入到历史数据中
         List<BusDeviceHistoryEntity> pumpHistories = pumps.stream().map(pump -> {
             BusDeviceHistoryEntity history = BusDeviceHistoryEntity.of(pump, clinicMap.get(pump.getClinicId()).get(0));
-            history.setUndoBy(undoConfig.getUndoBy());
-            history.setUndoTime(undoConfig.getUndoTime());
-            history.setDestroyer(undoConfig.getDestroyer());
-            history.setWitnesses(undoConfig.getWitnesses());
+            history.setUndoBy(manualUndoConfig.getUndoBy());
+            history.setUndoTime(manualUndoConfig.getUndoTime());
+            history.setDestroyer(manualUndoConfig.getDestroyer());
+            history.setWitnesses(manualUndoConfig.getWitnesses());
             history.setIsUndo(1);
             return history;
         }).collect(Collectors.toList());

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

@@ -56,7 +56,7 @@ public class LocalBusDeviceService extends BaseService<BusDeviceMapper, BusDevic
             deviceOperator.setAlias(entity.getAlias());
         }
         if(entity.getEnable()!=null){
-            deviceOperator.setEnable(entity.getEnable()==1);
+            deviceOperator.setEnable(entity.getEnable());
         }
     }
 

+ 31 - 0
coffee-system/src/main/java/com/coffee/bus/service/LocalBusHospitalConfigService.java

@@ -0,0 +1,31 @@
+package com.coffee.bus.service;
+
+import com.coffee.bus.entity.BusHospitalConfigEntity;
+import com.coffee.bus.mapper.BusHospitalConfigMapper;
+import com.coffee.common.crud.BaseService;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author lifang
+ * @version 1.0.0
+ * @ClassName LocalBusHospitalService.java
+ * @Description TODO
+ * @createTime 2022年03月19日 09:27:00
+ */
+@Service
+public class LocalBusHospitalConfigService extends BaseService<BusHospitalConfigMapper, BusHospitalConfigEntity,String> {
+    @Override
+    public void validateBeforeSave(BusHospitalConfigEntity entity) {
+
+    }
+
+    @Override
+    public void validateBeforeUpdate(BusHospitalConfigEntity entity) {
+
+    }
+
+    @Override
+    public void validateBeforeDelete(String id) {
+
+    }
+}

+ 2 - 2
coffee-system/src/main/java/com/coffee/bus/service/LocalBusPatientService.java

@@ -82,8 +82,8 @@ public class LocalBusPatientService extends BaseService<BusPatientMapper, BusPat
     @Transactional(rollbackFor = Exception.class)
     public void changePump(String hospitalId,String patientCode,String newDeviceId){
         log.info("医院id:[{}],病号:[{}],进行换泵操作,现设备id:[{}]",patientCode,hospitalId,newDeviceId);
-        netPumpService.update(new UpdateWrapper<BusDeviceRunningEntity>().lambda().eq(BusDeviceRunningEntity::getPatientCode,patientCode).set(BusDeviceRunningEntity::getMaster,0));
-        netPumpService.update(new UpdateWrapper<BusDeviceRunningEntity>().lambda().eq(BusDeviceRunningEntity::getDeviceId,newDeviceId).set(BusDeviceRunningEntity::getMaster,1));
+        netPumpService.update(new UpdateWrapper<BusDeviceRunningEntity>().lambda().eq(BusDeviceRunningEntity::getPatientCode,patientCode).set(BusDeviceRunningEntity::getMaster,false));
+        netPumpService.update(new UpdateWrapper<BusDeviceRunningEntity>().lambda().eq(BusDeviceRunningEntity::getDeviceId,newDeviceId).set(BusDeviceRunningEntity::getMaster,true));
     }
 
 

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

@@ -43,7 +43,7 @@ public class DeviceAlarmListener {
         });
         alarmService.save(alarmEntity);
         String tenantId = alarmEntity.getTenantId();
-        long count = alarmService.count(new QueryWrapper<BusDeviceAlarmEntity>().lambda().eq(BusDeviceAlarmEntity::getDoing, 1).eq(BusDeviceAlarmEntity::getTenantId,tenantId));
+        long count = alarmService.count(new QueryWrapper<BusDeviceAlarmEntity>().lambda().eq(BusDeviceAlarmEntity::getDoing, true).eq(BusDeviceAlarmEntity::getTenantId,tenantId));
         //报警信息推送
         String topic = WebSocketConstant.getDeviceStateCount(null, null, tenantId);
         redisTemplate.convertAndSend(topic, count);

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

@@ -123,7 +123,7 @@ public class DeviceInfoListener {
         String originClassify = deviceOperator.getClassification();
         String classification = device.getClassification();
         //默认为主泵,后续判断若不满足主泵条件,则替换为副泵
-        device.setMaster(1);
+        device.setMaster(true);
         if(classification==null){
             log.error("设备号:[{}]分包标识号为空,无法更新开始时间");
             classification="-1";
@@ -137,7 +137,7 @@ public class DeviceInfoListener {
         String usingId = deviceOperator.getUsingId();
         //todo 这部分操作交由上游处理
         device.setTenantId(deviceOperator.getTenantId());
-        device.setMonitorType(1);
+        device.setMonitorType(true);
         boolean first=false;
         if(StrUtil.isNullOrUndefined(usingId)){
             //设备首次运行,记录开机时间
@@ -157,7 +157,7 @@ public class DeviceInfoListener {
             deviceOperator.setUsingId(device.getId());
             deviceOperator.setStatus(device.getRunState());
             deviceOperator.setStartTime(device.getStartTime());
-            deviceOperator.setMaster(device.getMaster()!=null&&device.getMaster() == 1);
+            deviceOperator.setMaster(device.getMaster());
             deviceOperator.setPatientCode(device.getPatientCode());
             return null;
         });
@@ -187,7 +187,7 @@ public class DeviceInfoListener {
             Set<DeviceTimeSmallInfo> allDevice = Optional.ofNullable(currentPatientOperator.getAllDevice()).orElse(new HashSet<>());
             allDevice.add(DeviceTimeSmallInfo.of(deviceId,device.getStartTime()));
             currentPatientOperator.setAllDevice(allDevice);
-            if(device.getMaster()==1){
+            if(Boolean.TRUE.equals(device.getMaster())){
                 currentPatientOperator.setBindDeviceId(deviceId);
             }
             return null;
@@ -228,7 +228,7 @@ public class DeviceInfoListener {
                     deviceUsingService
                             .update(new UpdateWrapper<BusDeviceRunningEntity>().lambda()
                                     .eq(BusDeviceRunningEntity::getDeviceId,master.get().getDeviceId())
-                                    .set(BusDeviceRunningEntity::getMaster,1));
+                                    .set(BusDeviceRunningEntity::getMaster,true));
                     suppliers.add(()->{
                         patientOperator.setBindDeviceId(master.get().getDeviceId());
                         patientOperator.setAllDevice(remainPatientBindDevices);
@@ -259,10 +259,10 @@ public class DeviceInfoListener {
             if (startTime==null||startTime.before(device.getStartTime())) {
                 log.error("病号:[{}],之前主泵为:[{}],现在主泵为:[{}]",device.getPatientCode(),bindDeviceId,deviceId);
                 //设置当前上传信息的泵为主泵,将旧泵设置为副泵,并更新病人绑定泵的消息 todo 更新缓存信息
-                device.setMaster(1);
-                deviceUsingService.update(new UpdateWrapper<BusDeviceRunningEntity>().lambda().eq(BusDeviceRunningEntity::getDeviceId,bindDeviceId).set(BusDeviceRunningEntity::getMaster,0));
+                device.setMaster(true);
+                deviceUsingService.update(new UpdateWrapper<BusDeviceRunningEntity>().lambda().eq(BusDeviceRunningEntity::getDeviceId,bindDeviceId).set(BusDeviceRunningEntity::getMaster,false));
             }else {
-                device.setMaster(0);
+                device.setMaster(false);
             }
         }
     }
@@ -275,7 +275,7 @@ public class DeviceInfoListener {
      */
     private void handleAlarm(String historyId, BusDeviceRunningEntity device, DeviceOperator deviceOperator){
         Value value = deviceOperator.getValue(DeviceKeyConstant.ALARM);
-        BusDeviceAlarmEntity alarm = new BusDeviceAlarmEntity(device.getDeviceId(),device.getAlarm(),new Date(),0,historyId,device.getClinicId(),device.getClassification());
+        BusDeviceAlarmEntity alarm = new BusDeviceAlarmEntity(device.getDeviceId(),device.getAlarm(),new Date(),false,historyId,device.getClinicId(),device.getClassification());
         if(Objects.isNull(value.get())){
             if (device.getAlarm()==null) {
                 //未发生报警且上一信息不为报警信息,将报警信息置为历史信息
@@ -290,8 +290,8 @@ public class DeviceInfoListener {
                 //报警状态改变为过去式,将报警记录置为历史状态
                 alarmService.update(new UpdateWrapper<BusDeviceAlarmEntity>().lambda()
                         .eq(BusDeviceAlarmEntity::getDeviceId,device.getDeviceId())
-                        .eq(BusDeviceAlarmEntity::getDoing,0)
-                        .set(BusDeviceAlarmEntity::getDoing,1));
+                        .eq(BusDeviceAlarmEntity::getDoing,false)
+                        .set(BusDeviceAlarmEntity::getDoing,true));
                 SpringUtil.publishEvent(new DeviceAlarmEvent(this,alarm,historyId));
             } else {
                 //重复报警