Browse Source

add
添加重设参数值

18339543638 1 năm trước cách đây
mục cha
commit
4db63048c9

+ 73 - 55
nb-service/web-service/src/main/java/com/nb/web/service/bus/service/LocalBusHospitalService.java

@@ -3,7 +3,12 @@ package com.nb.web.service.bus.service;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.RandomUtil;
 import cn.hutool.core.util.StrUtil;
+import cn.hutool.crypto.digest.DigestUtil;
+import cn.hutool.http.HttpUtil;
+import cn.hutool.json.JSONObject;
+import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -21,6 +26,7 @@ import com.nb.web.service.bus.hospital.his.strategy.HisStrategyEnum;
 import com.nb.web.service.bus.mapper.BusHospitalMapper;
 import com.nb.web.service.bus.service.constant.LocalBusConAlarmService;
 import com.nb.web.service.bus.service.constant.LocalBusConMixService;
+import com.nb.web.service.bus.service.dto.IotHospitalAddDTO;
 import com.nb.web.service.bus.utils.CodeUtils;
 import com.nb.core.cache.ConfigStorage;
 import com.nb.core.cache.manager.ConfigStorageManager;
@@ -142,61 +148,78 @@ public class LocalBusHospitalService extends BaseService<BusHospitalMapper, BusH
 
     @Override
     public void postSave(BusHospitalEntity entity) {
-        CompletableFuture.runAsync(()->{
-            List<BusHospitalConfigEntity> configs =
-                    configService.list(new QueryWrapper<BusHospitalConfigEntity>().lambda()
-                            .or()
-                            .eq(BusHospitalConfigEntity::getTenantId, 1));
-            configs.forEach(config->{
-                config.setId(null);
-                config.setTenantId(entity.getId());
-            });
-            configService.saveBatch(configs);
-
-            //设置默认更新策略
-            HisUpdateEntity updateConfig = entity.getUpdateConfig();
-            if(updateConfig!=null){
-                hospitalManagerRegister.get(entity.getId()).refreshUpdateConfig(updateConfig);
-            }
 
-            //设置默认管理员角色
-            SysRole sysRole = new SysRole();
-            sysRole.setTenantId(entity.getId());
-            sysRole.setRoleName("超级管理员");
-            sysRole.setDataScope("1");
-            sysRole.setRoleCode("admin");
-            sysRole.setRemarks("超级管理员角色,不可编辑,不可删除");
-            sysRoleService.save(sysRole);
-            nameCache.setConfig(entity.getId(),entity.getName());
+        List<BusHospitalConfigEntity> configs =
+                configService.list(new QueryWrapper<BusHospitalConfigEntity>().lambda()
+                        .or()
+                        .eq(BusHospitalConfigEntity::getTenantId, 1));
+        configs.forEach(config->{
+            config.setId(null);
+            config.setTenantId(entity.getId());
+        });
+        configService.saveBatch(configs);
 
-            //设置默认常量信息
-            List<BusConMixEntity> drugCons = conMixService.list(new QueryWrapper<BusConMixEntity>()
-                    .lambda().eq(BusConMixEntity::getTenantId, "1")
-                    .eq(BusConMixEntity::getType, ConstantMixEnum.drugCate));
-            if(CollUtil.isNotEmpty(drugCons)){
-                conMixService.saveBatch(drugCons.stream().peek(mix->{
-                    mix.setId(null);
-                    mix.setTenantId(entity.getId());
-                }).collect(Collectors.toSet()));
-            }
+        //设置默认更新策略
+        HisUpdateEntity updateConfig = entity.getUpdateConfig();
+        if(updateConfig!=null){
+            hospitalManagerRegister.get(entity.getId()).refreshUpdateConfig(updateConfig);
+        }
 
-            //设置默认报警原因
-            List<BusConAlarmEntity> alarmCauses = conAlarmService.list(new QueryWrapper<BusConAlarmEntity>()
-                    .lambda().eq(BusConAlarmEntity::getTenantId, "1"));
-            if (CollUtil.isNotEmpty(alarmCauses)) {
-                conAlarmService.saveBatch(alarmCauses.stream().peek(alarmCause->{
-                    alarmCause.setId(null);
-                    alarmCause.setTenantId(entity.getId());
-                }).collect(Collectors.toSet()));
-            }
-        })
-                .whenComplete((i,e)->{
-                    if(e!=null){
-                        log.error("新增医院默认配置失败,",e);
-                    }
-                });
+        //设置默认管理员角色
+        SysRole sysRole = new SysRole();
+        sysRole.setTenantId(entity.getId());
+        sysRole.setRoleName("超级管理员");
+        sysRole.setDataScope("1");
+        sysRole.setRoleCode("admin");
+        sysRole.setRemarks("超级管理员角色,不可编辑,不可删除");
+        sysRoleService.save(sysRole);
+        nameCache.setConfig(entity.getId(),entity.getName());
+
+        //设置默认常量信息
+        List<BusConMixEntity> drugCons = conMixService.list(new QueryWrapper<BusConMixEntity>()
+                .lambda().eq(BusConMixEntity::getTenantId, "1")
+                .eq(BusConMixEntity::getType, ConstantMixEnum.drugCate));
+        if(CollUtil.isNotEmpty(drugCons)){
+            conMixService.saveBatch(drugCons.stream().peek(mix->{
+                mix.setId(null);
+                mix.setTenantId(entity.getId());
+            }).collect(Collectors.toSet()));
+        }
+
+        //设置默认报警原因
+        List<BusConAlarmEntity> alarmCauses = conAlarmService.list(new QueryWrapper<BusConAlarmEntity>()
+                .lambda().eq(BusConAlarmEntity::getTenantId, "1"));
+        if (CollUtil.isNotEmpty(alarmCauses)) {
+            conAlarmService.saveBatch(alarmCauses.stream().peek(alarmCause->{
+                alarmCause.setId(null);
+                alarmCause.setTenantId(entity.getId());
+            }).collect(Collectors.toSet()));
+        };
+
+        sendIotAddHospital(entity);
     }
 
+    private void sendIotAddHospital(BusHospitalEntity source){
+        IotHospitalAddDTO sendMsg = new IotHospitalAddDTO();
+        sendMsg.setCode(source.getCode());
+        sendMsg.setUsername(source.getName());
+        sendMsg.setMobile(RandomUtil.randomNumbers(11));
+        sendMsg.setEmail(source.getEmail());
+        sendMsg.setRegionCode(source.getAreaCode());
+        String content= new StringBuffer(sendMsg.getUsername()).append("&").append("yunzhineng").toString();
+        sendMsg.setMd5(DigestUtil.md5Hex(content));
+        try {
+            String post = HttpUtil.post("https://iot.tuoren.com/forward-service/open/addUser", JSONUtil.toJsonStr(sendMsg));
+            JSONObject jsonObject = JSONUtil.parseObj(post);
+            if("1".equals(jsonObject.getStr("code"))){
+                throw new RuntimeException("新增失败,"+jsonObject.getStr("msg"));
+            }
+        }catch (Exception e){
+            log.error("iot.tuoren.com : 医院["+ source.getName()+"]新增失败",e);
+        }
+
+
+    }
     @Override
     public void postUpdate(BusHospitalEntity entity) {
         hospitalManagerRegister.refresh(entity.getId(),true,null!=entity.getScript());
@@ -303,9 +326,4 @@ public class LocalBusHospitalService extends BaseService<BusHospitalMapper, BusH
     public List<HospitalResult> selectAll() {
         return BeanUtil.copyToList(list(),HospitalResult.class);
     }
-
-    @Override
-    public HospitalResult findById(String tenantId) {
-        return BeanUtil.copyProperties(getById(tenantId),HospitalResult.class);
-    }
 }

+ 53 - 4
nb-service/web-service/src/main/java/com/nb/web/service/bus/service/LocalBusInfusionHistoryService.java

@@ -1,8 +1,10 @@
 package com.nb.web.service.bus.service;
 
 import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -26,6 +28,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.Assert;
 
+import javax.validation.constraints.NotNull;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -161,7 +164,7 @@ public class LocalBusInfusionHistoryService extends BaseService<BusInfusionHisto
         if(CollectionUtil.size(undoConfigs)>50){
             throw new CustomException("一次性结束管理数量不能超过50个");
         }
-            undoConfigs.forEach(undoConfig -> this.undo(undoConfig,finishClinic));
+        undoConfigs.forEach(undoConfig -> this.undo(undoConfig,finishClinic));
 //        }else {
 //            //批量结束临床
 //            Map<String, List<ManualUndoConfig>> configsMap = undoConfigs.stream().collect(Collectors.groupingBy(ManualUndoConfig::getTenantId));
@@ -319,15 +322,61 @@ public class LocalBusInfusionHistoryService extends BaseService<BusInfusionHisto
     }
 
     public List<CombineEvalResult> queryStatsEval(CombineQuery query) {
-        return this.baseMapper.queryStatsEval(query);
+        List<CombineEvalResult> result = this.baseMapper.queryStatsEval(query);
+        fillEvalResultPatientInfo(result);
+        return result;
     }
 
     public List<CombineEvalResult> listStatsEval(CombineQuery query) {
-        return this.baseMapper.listStatsEval(query);
+        List<CombineEvalResult> result = this.baseMapper.listStatsEval(query);
+        fillEvalResultPatientInfo(result);
+        return result;
     }
 
     public IPage<CombineEvalResult> pageStatsEval(CombineQuery query, Page<CombineResult> page) {
-        return this.baseMapper.pageStatsEval(query,page);
+        IPage<CombineEvalResult> result = this.baseMapper.pageStatsEval(query, page);
+        fillEvalResultPatientInfo(result.getRecords());
+        return result;
+    }
+
+    private void fillEvalResultPatientInfo(List<CombineEvalResult> evals){
+        if(CollectionUtil.isEmpty(evals)){
+            return;
+        }
+        Set<String> clinicIds = evals.stream()
+                .filter(e -> StrUtil.isNotBlank(e.getClinicId()))
+                .map(CombineEvalResult::getClinicId)
+                .collect(Collectors.toSet());
+        if(CollectionUtil.isEmpty(clinicIds)){
+            return;
+        }
+        List<BusClinicEntity> clinics = clinicService.list(new LambdaQueryWrapper<BusClinicEntity>()
+                .select(BusClinicEntity::getId,
+                        BusClinicEntity::getStartTime,
+                        BusClinicEntity::getPatientId,
+                        BusClinicEntity::getPatientCode,
+                        BusClinicEntity::getPatientGender,
+                        BusClinicEntity::getPatientName,
+                        BusClinicEntity::getPatientAge,
+                        BusClinicEntity::getSurgeryName)
+        .in(BusClinicEntity::getId,clinicIds));
+        if(CollectionUtil.isEmpty(clinics)){
+            return;
+        }
+        Map<String, BusClinicEntity> clinicMap = clinics.stream()
+                .collect(Collectors.groupingBy(BusClinicEntity::getId, Collectors.collectingAndThen(Collectors.toList(), CollectionUtil::getFirst)));
+        for (CombineEvalResult eval : evals) {
+            String clinicId = eval.getClinicId();
+            BusClinicEntity clinic = clinicMap.get(clinicId);
+            if(ObjectUtil.isNull(clinic)){
+                continue;
+            }
+            eval.setPatientName(clinic.getPatientName());
+            eval.setPatientCode(clinic.getPatientCode());
+            eval.setPatientGender(clinic.getPatientGender());
+            eval.setPatientAge(clinic.getPatientAge());
+            eval.setSurgeryName(clinic.getSurgeryName());
+        }
     }
 
     public BusInfusionModifyEntity lastModify(String infusionId){

+ 117 - 10
nb-service/web-service/src/main/java/com/nb/web/service/bus/service/LocalBusPatientService.java

@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.date.LocalDateTimeUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.extra.spring.SpringUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -46,7 +47,6 @@ import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.context.request.async.DeferredResult;
-
 import javax.validation.constraints.NotNull;
 import java.time.LocalDateTime;
 import java.time.ZoneOffset;
@@ -55,6 +55,8 @@ import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
+import java.util.stream.Collector;
+import java.util.stream.Collectors;
 
 /**
  * @author lifang
@@ -115,12 +117,10 @@ public class LocalBusPatientService extends BaseService<BusPatientMapper, BusPat
 
     @Override
     public void validateBeforeUpdate(BusPatientEntity entity) {
-
     }
 
     @Override
     public void validateBeforeDelete(String id) {
-
     }
 
     @Override
@@ -180,7 +180,7 @@ public class LocalBusPatientService extends BaseService<BusPatientMapper, BusPat
     public long monitorTotalCount(String tenantId) {
         PatientMonitorQuery patientMonitorQuery = new PatientMonitorQuery();
         patientMonitorQuery.setTenantId(tenantId);
-        return CollUtil.size(this.baseMapper.selectMonitor(Page.of(0,500,false),patientMonitorQuery).getRecords());
+        return CollUtil.size(this.baseMapper.selectMonitor(Page.of(0,9999,false),patientMonitorQuery).getRecords());
     }
 
     /**
@@ -229,11 +229,115 @@ public class LocalBusPatientService extends BaseService<BusPatientMapper, BusPat
     @Override
     public List<PatientMonitorResult> selectAll(PatientMonitorQuery query) {
         Page<PatientMonitorResult> page = new Page<>(0, 9999, false);
+
+        List<BusDeviceEntity> deviceList = deviceService.getBaseMapper().selectList(new LambdaQueryWrapper<BusDeviceEntity>()
+                .select(BusDeviceEntity::getDeviceId,BusDeviceEntity::getAlias,BusDeviceEntity::getProductNo)
+                .eq(BusDeviceEntity::getTenantId,query.getTenantId())
+                .nested(StrUtil.isNotBlank(query.getBlurry()),i-> i.like(StrUtil.isNotBlank(query.getDeviceId()), BusDeviceEntity::getDeviceId, query.getDeviceId())
+                        .or()
+                        .like(StrUtil.isNotBlank(query.getDeviceAlias()), BusDeviceEntity::getAlias, query.getDeviceAlias())));
+        Map<String, BusDeviceEntity> deviceMap=new HashMap<>();
+        if(CollectionUtil.isNotEmpty(deviceList)){
+            deviceMap = deviceList.stream()
+                    .collect(Collectors.groupingBy(BusDeviceEntity::getDeviceId, Collectors.collectingAndThen(Collectors.toList(), CollectionUtil::getFirst)));
+        }
+
         IPage<PatientMonitorResult> result = this.baseMapper.selectMonitor(page, query);
-        if (CollectionUtil.isNotEmpty(result.getRecords())) {
-            result.getRecords().forEach(PatientMonitorResult::handleWarn);
+
+        List<PatientMonitorResult> records = result.getRecords();
+
+        if (CollectionUtil.isNotEmpty(records)) {
+            List<PatientMonitorResult> removeList = new ArrayList<>();
+            for (PatientMonitorResult record : records) {
+                if (!allowResult(record,query,deviceMap)) {
+                    removeList.add(record);
+                    continue;
+                }
+                record.handleWarn();
+            }
+            records.removeAll(removeList);
+        }
+        return records;
+    }
+
+    private boolean allowResult(PatientMonitorResult result, PatientMonitorQuery query, Map<String, BusDeviceEntity> deviceMap){
+        boolean search=false;
+        BusDeviceEntity device = deviceMap.get(result.getDeviceId());
+        if(ObjectUtil.isNotNull(device)){
+            result.setDeviceAlias(device.getAlias());
+            result.setProductNo(device.getProductNo());
+            if (StrUtil.isNotBlank(query.getDeviceId()) && StrUtil.isNotBlank(query.getDeviceAlias())) {
+                return true;
+            }
+        }
+
+        if(StrUtil.isNotBlank(query.getBlurry())){
+            search=true;
+            boolean pattern = StrUtil.contains(result.getBedNo(), query.getBlurry()) ||
+                    StrUtil.contains(result.getPatientName(), query.getBlurry()) ||
+                    StrUtil.contains(result.getPatientCode(), query.getBlurry());
+            if(pattern){
+                return true;
+            }
+        }
+
+
+        if (StrUtil.isNotBlank(query.getBedNo())) {
+            search=true;
+            if(StrUtil.contains(result.getBedNo(),query.getBedNo())){
+                return true;
+            }
+        }
+
+        if (StrUtil.isNotBlank(query.getName())) {
+            search=true;
+            if(StrUtil.contains(result.getPatientName(),query.getName())){
+                return true;
+            }
+        }
+
+        if (StrUtil.isNotBlank(query.getCode())) {
+            search=true;
+            if(StrUtil.contains(result.getPatientCode(),query.getCode())){
+                return true;
+            }
+        }
+
+        if (StrUtil.isNotBlank(query.getDeviceId())) {
+            search=true;
+            if(StrUtil.contains(result.getDeviceId(),query.getDeviceId())){
+                return true;
+            }
+        }
+
+        if (StrUtil.isNotBlank(query.getAnaType())) {
+            search=true;
+            if(StrUtil.contains(result.getAnaType(),query.getAnaType())){
+                return true;
+            }
         }
-        return result.getRecords();
+
+        if (ObjectUtil.isNotNull(query.getGender())) {
+            search=true;
+            if(ObjectUtil.isNotNull(result.getGender())&&ObjectUtil.equals(result.getGender().getValue(),query.getGender())){
+                return true;
+            }
+        }
+
+        if (ObjectUtil.isNotNull(query.getAnaDoctor())) {
+            search=true;
+            if(StrUtil.contains(result.getAnaDoctor(),query.getAnaDoctor())){
+                return true;
+            }
+        }
+
+        if (ObjectUtil.isNotNull(query.getSurgeName())) {
+            search=true;
+            if(StrUtil.contains(result.getSurgeryName(),query.getSurgeName())){
+                return true;
+            }
+        }
+        return !search;
     }
 
     /**
@@ -559,7 +663,6 @@ public class LocalBusPatientService extends BaseService<BusPatientMapper, BusPat
             CompletableFuture.runAsync(()-> wsPublishUtils.publishPatientMonitor(clinic.getPatientId(),clinic.getTenantId()));
             SpringUtil.publishEvent(new ClinicManageEvent(this,clinic.getTenantId(),clinic.getPatientId(),manageEnum));
         }
-
         return result;
     }
 
@@ -625,12 +728,16 @@ public class LocalBusPatientService extends BaseService<BusPatientMapper, BusPat
         if(inviteCodeNode==null){
             throw new CustomException("该邀请码已失效");
         }
-        return    PatientByInviteCodeResult.of(inviteCode,inviteCodeNode.getTenantId(),
+        PatientByInviteCodeResult result = PatientByInviteCodeResult.of(inviteCode, inviteCodeNode.getTenantId(),
                 inviteCodeNode.getTenantName(),
                 inviteCodeNode.getDoctorId(),
                 inviteCodeNode.getDoctorName(),
                 this.lookMonitorByPatientId(inviteCodeNode.getPatientId(),
-                        inviteCodeNode.getTenantId())) ;
+                        inviteCodeNode.getTenantId()));
+        if(ObjectUtil.isNotNull(result.getResult())){
+            result.getResult().setManageType(  getManageType(inviteCodeNode.getPatientId()));
+        }
+        return   result;
     }
 
     @Override

+ 4 - 0
nb-service/web-service/src/main/java/com/nb/web/service/bus/service/dto/ClinicStatsQueryResult.java

@@ -39,6 +39,10 @@ public class ClinicStatsQueryResult implements Serializable {
     private Integer rsrq;
     @ApiModelProperty(value = "参考信号接收功率",hidden = true)
     private Integer rsrp;
+    @ApiModelProperty(value = "运行时电机的压力值",hidden = true)
+    private Integer block1;
+    @ApiModelProperty(value = "非运行时电机的压力值",hidden = true)
+    private Integer block2;
     @ApiModelProperty(value = "数据上传时间",hidden = true)
     private Date uploadTime;
     @ApiModelProperty(hidden = true)

+ 5 - 1
nb-service/web-service/src/main/resources/mapper/bus/BusClinicMapper.xml

@@ -12,6 +12,8 @@
         <result column="upload_time" property="uploadTime"/>
         <result column="infusion_id" property="infusionId"/>
         <result column="electric_quantity" property="electricQuantity"/>
+        <result column="block1" property="block1"/>
+        <result column="block2" property="block2"/>
     </resultMap>
 
     <resultMap id="queryResult" type="com.nb.web.service.bus.service.dto.ClinicResult">
@@ -70,6 +72,8 @@
         <if test="query.rsrp!=false">
             h.rsrp as rsrp,
         </if>
+        h.block1 as block1,
+        h.block2 as block2,
         h.upload_time,
         h.infusion_id
         FROM
@@ -102,7 +106,7 @@
     </select>
 
     <select id="pageQuery" resultMap="queryResult" parameterType="com.nb.web.service.bus.service.dto.ClinicQuery">
-        select p.id as patient_id,
+       select p.id as patient_id,
         c.id as clinic_id,
         c.patient_code as patient_code,
         c.patient_name as patient_name,

+ 25 - 13
nb-service/web-service/src/main/resources/mapper/bus/BusDeviceMapper.xml

@@ -97,20 +97,20 @@
 
     <select id="view" resultMap="pageQueryResult">
         select
-        d.id as id,
-        d.device_id as device_id,
-        d.version as version,
-        d.alias as alias,
-        ifnull(i.type,0) as type,
-        d.config as config,
-        d.product_no as product_no,
-        d.create_time as create_time,
-        d.update_time as update_time,
-        d.tenant_id as tenant_id
+            d.id as id,
+            d.device_id as device_id,
+            d.version as version,
+            d.alias as alias,
+            ifnull(i.type,0) as type,
+            d.config as config,
+            d.product_no as product_no,
+            d.create_time as create_time,
+            d.update_time as update_time,
+            d.tenant_id as tenant_id
         from (select * from bus_device where id=#{id})
-         AS d
-        LEFT JOIN (select * from bus_infusion_history) as i
-        on i.id=d.infusion_id
+                 AS d
+                 LEFT JOIN (select * from bus_infusion_history) as i
+                           on i.id=d.infusion_id
         order by d.create_time desc
     </select>
 
@@ -129,4 +129,16 @@
     <select id="hospitalCode" resultType="java.lang.String">
         select  bh.code from  bus_device as bd join bus_hospital as bh on bd.tenant_id = bh.tenant_id  where bd.device_id = #{deviceId}
     </select>
+
+
+    <resultMap id="hospitalCodeAndAliasResult" type="com.nb.web.service.bus.controller.vo.BusHospitalCodeAndAliasVO">
+        <result column="code" property="hospitalCode"/>
+        <result column="alias" property="alias"/>
+    </resultMap>
+
+    <select id="hospitalCodeAndAlias" resultMap="hospitalCodeAndAliasResult">
+        select  bh.code as code,
+                bd.alias as alias
+        from  bus_device as bd join bus_hospital as bh on bd.tenant_id = bh.tenant_id  where bd.device_id = #{deviceId}
+    </select>
 </mapper>

+ 6 - 52
nb-service/web-service/src/main/resources/mapper/bus/BusInfusionHistoryMapper.xml

@@ -114,7 +114,6 @@
         <result column="evaluator" property="evaluator"/>
         <result column="blood_oxygen_saturation" property="bloodOxygenSaturation"/>
         <result column="patient_code" property="patientCode"/>
-        <result column="remark" property="remark"/>
     </resultMap>
 
     <resultMap id="queryStatsHistory" type="com.nb.web.service.bus.service.dto.CombineHistoryResult">
@@ -316,22 +315,8 @@
         i.id as infusion_id,
         i.last_upload_time as last_upload_time,
         i.start_time as infusion_start_time,
-        c.patient_code as patient_code,
-        c.ward as ward,
-        c.bed_no as bed_no,
-        c.surgery_name as surgery_name,
-        c.asa as asa,
-        c.patient_gender as patient_gender,
-        c.`patient_name` as patient_name,
-        c.`patient_age` as patient_age,
-        c.weight as weight,
-        c.`height` as height,
-        c.ana_doctor as ana_doctor,
-        c.ana_type as ana_type,
-        c.anal_type as anal_type,
-        c.surgery_doctor as surgery_doctor,
-        c.formula as formula,
-        c.entrust as entrust,
+        e.patient_code as patient_code,
+        c.id as clinic_id,
         e.evaluate_time as evaluate_time,
         e.statics as statics,
         e.activity as activity,
@@ -380,22 +365,7 @@
         i.id as infusion_id,
         i.last_upload_time as last_upload_time,
         i.start_time as infusion_start_time,
-        c.patient_code as patient_code,
-        c.ward as ward,
-        c.bed_no as bed_no,
-        c.surgery_name as surgery_name,
-        c.asa as asa,
-        c.patient_gender as patient_gender,
-        c.`patient_name` as patient_name,
-        c.`patient_age` as patient_age,
-        c.weight as weight,
-        c.`height` as height,
-        c.ana_doctor as ana_doctor,
-        c.ana_type as ana_type,
-        c.anal_type as anal_type,
-        c.surgery_doctor as surgery_doctor,
-        c.formula as formula,
-        c.entrust as entrust,
+        c.id as clinic_id,
         e.evaluate_time as evaluate_time,
         e.statics as statics,
         e.activity as activity,
@@ -420,8 +390,7 @@
         e.breath_rate as breath_rate,
         e.blood_oxygen_saturation as blood_oxygen_saturation,
         e.id as eval_id,
-        e.evaluator as evaluator,
-        e.remark as remark
+        e.evaluator as evaluator
         from (
         <include refid="commonInfusionQuery"/>
         ) as i
@@ -445,22 +414,7 @@
         i.id as infusion_id,
         i.last_upload_time as last_upload_time,
         i.start_time as infusion_start_time,
-        c.patient_code as patient_code,
-        c.ward as ward,
-        c.bed_no as bed_no,
-        c.surgery_name as surgery_name,
-        c.asa as asa,
-        c.patient_gender as patient_gender,
-        c.`patient_name` as patient_name,
-        c.`patient_age` as patient_age,
-        c.weight as weight,
-        c.`height` as height,
-        c.ana_doctor as ana_doctor,
-        c.ana_type as ana_type,
-        c.anal_type as anal_type,
-        c.surgery_doctor as surgery_doctor,
-        c.formula as formula,
-        c.entrust as entrust,
+        c.id as clinic_id,
         e.evaluate_time as evaluate_time,
         e.statics as statics,
         e.activity as activity,
@@ -535,7 +489,7 @@
         </where>
         ) as p on p.id = c.patient_id
         join (select * from bus_device_history) as h on h.infusion_id=i.id
-        group by i.id,c.id,DATE_FORMAT(h.upload_time,'%Y-%m-%d')
+        group by i.id,c.id,h.upload_time
     </select>
 
 

+ 49 - 46
nb-service/web-service/src/main/resources/mapper/bus/BusPatientMapper.xml

@@ -82,6 +82,9 @@
         <result column="eval_time" property="evalTime"/>
         <result column="patient_id" property="patientId"/>
         <result column="manage_type" property="manageType"/>
+        <result column="block1" property="block1"/>
+        <result column="block2" property="block2"/>
+        <result column="block_status" property="blockStatus"/>
     </resultMap>
 
     <resultMap id="deviceNone" type="com.nb.web.service.bus.service.dto.PatientDeviceNoneResult">
@@ -223,8 +226,11 @@
         i.remark as remark,
         i.type as device_type,
         i.last_upload_time as last_upload_time,
-        d.alias as device_alias,
-        d.product_no as product_no ,
+        i.block1 as block1,
+        i.block2 as block2,
+        i.block_status  as block_status,
+        <!--d.alias as device_alias,-->
+        <!--d.product_no as product_no ,-->
         c.patient_gender as patient_gender,
         c.`patient_name` as patient_name,
         c.finished as finished,
@@ -322,15 +328,15 @@
             </choose>
         </where>
         ) as i on p.infusion_id=i.id
-        left join
-        (select device_id,alias,product_no
-        from bus_device
-        <where>
-            <if test="query.tenantId!=null">
-                and tenant_id=#{query.tenantId}
-            </if>
-        </where>
-        ) as d on d.device_id=i.device_id
+        <!--left join-->
+        <!--(select device_id,alias,product_no-->
+        <!--from bus_device-->
+        <!--<where>-->
+            <!--<if test="query.tenantId!=null">-->
+                <!--and tenant_id=#{query.tenantId}-->
+            <!--</if>-->
+        <!--</where>-->
+        <!--) as d on d.device_id=i.device_id-->
         join (select * from bus_clinic
         <where>
             finished=0
@@ -351,41 +357,38 @@
             </if>
         </where>
         ) c on p.clinic_id=c.id
-        <if test="query.bedNo!=null || query.name!=null || query.code!=null || query.anaDoctor!=null || query.surgeName!=null ||query.gender!=null ||query.anaType!=null || query.deviceId != null || query.productNo!=null">
-            <where>
-                (1=0
-                <if test="query.productNo!=null">
-                    or d.product_no LIKE concat('%', #{query.productNo}, '%')
-                </if>
-                <if test="query.bedNo!=null">
-                    or c.bed_no LIKE concat('%', #{query.bedNo}, '%')
-                </if>
-                <if test="query.name!=null">
-                    or c.`patient_name` LIKE concat('%', #{query.name}, '%')
-                </if>
-                <if test="query.code!=null">
-                    or p.`code` LIKE concat('%', #{query.code}, '%')
-                </if>
-                <if test="query.anaDoctor!=null">
-                    or c.`ana_doctor` like concat('%', #{query.anaDoctor}, '%')
-                </if>
-                <if test="query.surgeName!=null">
-                    or c.`surgery_name` like concat('%',#{query.surgeName}, '%')
-                </if>
-                <if test="query.gender!=null">
-                    or c.patient_gender LIKE concat('%', #{query.gender}, '%')
-                </if>
-                <if test="query.anaType!=null">
-                    or c.ana_type LIKE concat('%', #{query.anaType}, '%')
-                </if>)
-                <if test="query.deviceId!=null">
-                    or i.device_id like concat('%', #{query.deviceId}, '%')
-                </if>
-                <if test="query.deviceAlias!=null">
-                    or d.alias like concat('%', #{query.deviceAlias}, '%')
-                </if>
-            </where>
-        </if>
+        <!--<if test="query.bedNo!=null || query.name!=null || query.code!=null || query.anaDoctor!=null || query.surgeName!=null ||query.gender!=null ||query.anaType!=null || query.deviceId != null || query.productNo!=null">-->
+            <!--<where>-->
+                <!--(1=0-->
+                <!--<if test="query.bedNo!=null">-->
+                    <!--or c.bed_no LIKE concat('%', #{query.bedNo}, '%')-->
+                <!--</if>-->
+                <!--<if test="query.name!=null">-->
+                    <!--or c.`patient_name` LIKE concat('%', #{query.name}, '%')-->
+                <!--</if>-->
+                <!--<if test="query.code!=null">-->
+                    <!--or p.`code` LIKE concat('%', #{query.code}, '%')-->
+                <!--</if>-->
+                <!--<if test="query.anaDoctor!=null">-->
+                    <!--or c.`ana_doctor` like concat('%', #{query.anaDoctor}, '%')-->
+                <!--</if>-->
+                <!--<if test="query.surgeName!=null">-->
+                    <!--or c.`surgery_name` like concat('%',#{query.surgeName}, '%')-->
+                <!--</if>-->
+                <!--<if test="query.gender!=null">-->
+                    <!--or c.patient_gender LIKE concat('%', #{query.gender}, '%')-->
+                <!--</if>-->
+                <!--<if test="query.anaType!=null">-->
+                    <!--or c.ana_type LIKE concat('%', #{query.anaType}, '%')-->
+                <!--</if>)-->
+                <!--&lt;!&ndash;<if test="query.deviceId!=null">&ndash;&gt;-->
+                    <!--&lt;!&ndash;or i.device_id like concat('%', #{query.deviceId}, '%')&ndash;&gt;-->
+                <!--&lt;!&ndash;</if>&ndash;&gt;-->
+                <!--&lt;!&ndash;<if test="query.deviceAlias!=null">&ndash;&gt;-->
+                    <!--&lt;!&ndash;or d.alias like concat('%', #{query.deviceAlias}, '%')&ndash;&gt;-->
+                <!--&lt;!&ndash;</if>&ndash;&gt;-->
+            <!--</where>-->
+        <!--</if>-->
         order by c.monitor_start_time desc
     </select>