Explorar el Código

fix
优化查询方式

18339543638 hace 1 año
padre
commit
9e44cff8f2

+ 0 - 1
nb-service/app-assistant/src/main/java/com/nb/app/assistant/listener/ClinicManageInfoListener.java

@@ -23,7 +23,6 @@ public class ClinicManageInfoListener {
     private final LocalAssistantUserBindService userBindService;
 
     @EventListener
-    @Async
     public void clinicManageInfo(ClinicManageEvent event){
         String patientId = event.getPatientId();
         userBindService.update(new UpdateWrapper<AssistantUserBindEntity>()

+ 0 - 4
nb-service/web-service/src/main/java/com/nb/web/service/bus/controller/BusPatientController.java

@@ -159,7 +159,6 @@ public class BusPatientController  implements BaseQueryController<BusPatientEnti
                 throw new CustomException("未选择住院号");
             }
             R<Boolean> result = monitorFinished(monitorFinishedVo, tenantId);
-            patientService.deleteAllCache(tenantId);
             CompletableFuture.runAsync(()->wsPublishUtils.publishMonitorTotalCount(tenantId))
                     .thenRunAsync(()->wsPublishUtils.publishDeviceNone(tenantId))
                     .thenRunAsync(()->wsPublishUtils.publishMonitorStateCount(tenantId));
@@ -229,7 +228,6 @@ public class BusPatientController  implements BaseQueryController<BusPatientEnti
         R<Boolean> result = R.success(clinicService.update(new UpdateWrapper<BusClinicEntity>().lambda().eq(BusClinicEntity::getId, clinicId)
                 .set(BusClinicEntity::getEndTime, null)));
         BusClinicEntity clinic = clinicService.getById(clinicId);
-        patientService.deleteAllCache(clinic.getTenantId());
         wsPublishUtils.publishPatientMonitor(clinic.getPatientId(),clinic.getTenantId());
         return result;
     }
@@ -258,7 +256,6 @@ public class BusPatientController  implements BaseQueryController<BusPatientEnti
     public R shift(@RequestBody@Validated DeviceShiftConfig shiftConfig){
         log.info("主泵切换的操作,【{}】",JSONUtil.toJsonStr(shiftConfig));
         patientService.shift(shiftConfig);
-        patientService.deleteAllCache(shiftConfig.getTenantId());
         wsPublishUtils.publishPatientMonitor(shiftConfig.getPatientId(),shiftConfig.getTenantId());
         return R.success();
     }
@@ -276,7 +273,6 @@ public class BusPatientController  implements BaseQueryController<BusPatientEnti
         }
         //泵切换完成后,对病号报警解除
         infusionService.undo(undoConfig,false);
-        patientService.deleteAllCache(undoConfig.getTenantId());
         wsPublishUtils.publishPatientMonitor(patient.getId(),undoConfig.getTenantId());
         return R.success();
     }

+ 0 - 3
nb-service/web-service/src/main/java/com/nb/web/service/bus/listener/DeviceInfoListener.java

@@ -1,6 +1,5 @@
 package com.nb.web.service.bus.listener;
 
-import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.comparator.CompareUtil;
 import cn.hutool.core.map.MapUtil;
 import cn.hutool.core.util.ObjectUtil;
@@ -19,7 +18,6 @@ import com.nb.web.api.enums.DeviceTypeEnum;
 import com.nb.web.api.enums.FlowStatusEnum;
 import com.nb.web.api.enums.PatientAlarmEnum;
 import com.nb.web.service.bus.hospital.HospitalManagerRegister;
-import com.nb.web.service.bus.registry.constant.DeviceKeyConstant;
 import com.nb.web.service.bus.registry.device.DeviceOperator;
 import com.nb.web.service.bus.registry.device.DeviceRegistry;
 import com.nb.web.service.bus.registry.patient.PatientOperator;
@@ -164,7 +162,6 @@ public class DeviceInfoListener implements IIotMsgHandler {
             }
 
             cacheOperation.add(()->{
-                patientService.deleteAllCache(device.getTenantId());
                 deviceOperator.setUploadTime(device.getUploadTime());
                 wsPublishUtils.publishPatientMonitor(device.getPatientId(),device.getTenantId());
                 //非测试数据再进行处理

+ 0 - 1
nb-service/web-service/src/main/java/com/nb/web/service/bus/listener/HisInfoListener.java

@@ -69,7 +69,6 @@ public class HisInfoListener {
                     //找到第一个匹配的处理器进行处理
                     .findFirst()
                     .ifPresent(handler-> handler.handle(sources,target));
-            patientService.deleteAllCache(hospitalId);
         } catch (Exception e){
             log.error("解析his数据时出错,解析后数据:{},错误原因,{}",JSONUtil.toJsonStr(infoEvent),e.getLocalizedMessage());
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();

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

@@ -223,8 +223,8 @@
         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 ,
+        <!--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 +322,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,38 +351,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.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>