浏览代码

fix 绑定病人时再次判断病人信息

18339543638 3 年之前
父节点
当前提交
58e2c19923

+ 0 - 1
nb-im/src/main/java/com/nb/im/service/LocalImRoomService.java

@@ -124,7 +124,6 @@ public class LocalImRoomService extends BaseService<ImRoomMapper, ImRoomEntity,S
         if(assistantUser==null){
             throw new CustomException("该看护人不存在,请刷新后重试");
         }
-
         entity.setAssistAvatar(assistantUser.getAvatar());
         entity.setDoctorAvatar(doctorUser.getAvatar());
     }

+ 2 - 3
nb-service/app-assistant/src/main/java/com/nb/app/assistant/controller/PatientOperationController.java

@@ -127,9 +127,8 @@ public class PatientOperationController {
         if(ApplyEnum.INVITE_CODE.equals(vo.getApplyType())&& StrUtil.isEmpty(vo.getPatientId())){
             throw new CustomException("病人id不能为空");
         }
-        if(StrUtil.isEmpty(vo.getPatientId())){
-            vo.setPatientId(patientClient.lookPatientId(vo.getTenantId(),vo.getPatientCode()));
-        }
+        //再次根据住院号和医院设置病人id,以免出现错误信息
+        vo.setPatientId(patientClient.lookPatientId(vo.getTenantId(),vo.getPatientCode()));
         if(vo.getManageType()==null){
             vo.setManageType(patientClient.getManageType(vo.getPatientId()));
         }

+ 23 - 0
nb-service/web-service/src/main/java/com/nb/web/service/bus/service/LocalBusHospitalConfigService.java

@@ -3,6 +3,7 @@ package com.nb.web.service.bus.service;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.nb.auth.utils.SecurityUtil;
 import com.nb.web.api.entity.common.BusDeviceRunningEntity;
 import com.nb.web.api.entity.BusHospitalConfigEntity;
 import com.nb.web.api.feign.IHospitalConfigClient;
@@ -64,6 +65,28 @@ public class LocalBusHospitalConfigService extends BaseService<BusHospitalConfig
 
     }
 
+    @Override
+    public boolean save(BusHospitalConfigEntity entity) {
+        this.validateBeforeSave(entity);
+        String tenantId = SecurityUtil.getTenantId();
+        BusHospitalConfigEntity hospitalConfig = this.getOne(new QueryWrapper<BusHospitalConfigEntity>()
+                .lambda()
+                .eq(BusHospitalConfigEntity::getType, entity.getType().getValue())
+                .eq(BusHospitalConfigEntity::getTenantId, tenantId)
+                .last("limit 1"));
+        if(hospitalConfig!=null){
+            entity.setId(hospitalConfig.getId());
+            return this.updateById(entity);
+        }else {
+            if (super.save(entity)) {
+                postSave(entity);
+                return true;
+            }
+            return false;
+        }
+    }
+
+
     @Override
     public void postSave(BusHospitalConfigEntity entity) {
         BusHospitalConfigEntity configEntity = this.getById(entity.getId());