|
@@ -10,7 +10,7 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
import com.coffee.bus.bean.HisInfo;
|
|
import com.coffee.bus.bean.HisInfo;
|
|
|
import com.coffee.bus.entity.BusClinicEntity;
|
|
import com.coffee.bus.entity.BusClinicEntity;
|
|
|
import com.coffee.bus.entity.BusDeviceUsingEntity;
|
|
import com.coffee.bus.entity.BusDeviceUsingEntity;
|
|
|
-import com.coffee.bus.entity.BusPumpHistoryEntity;
|
|
|
|
|
|
|
+import com.coffee.bus.entity.BusDeviceHistoryEntity;
|
|
|
import com.coffee.bus.entity.BusPatientEntity;
|
|
import com.coffee.bus.entity.BusPatientEntity;
|
|
|
import com.coffee.bus.listener.event.bean.HistoryInfoEvent;
|
|
import com.coffee.bus.listener.event.bean.HistoryInfoEvent;
|
|
|
import com.coffee.bus.script.ExecuteResult;
|
|
import com.coffee.bus.script.ExecuteResult;
|
|
@@ -46,14 +46,14 @@ public class HistoryInfoListener {
|
|
|
|
|
|
|
|
private final LocalBusClinicService clinicService;
|
|
private final LocalBusClinicService clinicService;
|
|
|
|
|
|
|
|
- private final LocalBusPumpHistoryService historyService;
|
|
|
|
|
|
|
+ private final LocalBusDeviceHistoryService historyService;
|
|
|
|
|
|
|
|
private final RedisTemplate redisTemplate;
|
|
private final RedisTemplate redisTemplate;
|
|
|
|
|
|
|
|
private final LocalBusDeviceUsingService pumpService;
|
|
private final LocalBusDeviceUsingService pumpService;
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
- public HistoryInfoListener(ScriptManager scriptManager, LocalBusPatientService patientService, LocalBusClinicService clinicService, LocalBusPumpHistoryService historyService, RedisTemplate redisTemplate, LocalBusDeviceUsingService pumpService) {
|
|
|
|
|
|
|
+ public HistoryInfoListener(ScriptManager scriptManager, LocalBusPatientService patientService, LocalBusClinicService clinicService, LocalBusDeviceHistoryService historyService, RedisTemplate redisTemplate, LocalBusDeviceUsingService pumpService) {
|
|
|
this.scriptManager = scriptManager;
|
|
this.scriptManager = scriptManager;
|
|
|
this.patientService = patientService;
|
|
this.patientService = patientService;
|
|
|
this.clinicService = clinicService;
|
|
this.clinicService = clinicService;
|
|
@@ -136,20 +136,20 @@ public class HistoryInfoListener {
|
|
|
public void updateClinic(BusClinicEntity clinic,Long requestId){
|
|
public void updateClinic(BusClinicEntity clinic,Long requestId){
|
|
|
clinic.setId(String.valueOf(IdWorker.getId()));
|
|
clinic.setId(String.valueOf(IdWorker.getId()));
|
|
|
//找到此病号信息且未绑定临床号,获取临床绑定设备号,并将临床信息与此次信息进行绑定
|
|
//找到此病号信息且未绑定临床号,获取临床绑定设备号,并将临床信息与此次信息进行绑定
|
|
|
- List<BusPumpHistoryEntity> historyList = historyService.list(
|
|
|
|
|
- new QueryWrapper<BusPumpHistoryEntity>()
|
|
|
|
|
|
|
+ List<BusDeviceHistoryEntity> historyList = historyService.list(
|
|
|
|
|
+ new QueryWrapper<BusDeviceHistoryEntity>()
|
|
|
.lambda()
|
|
.lambda()
|
|
|
- .select(BusPumpHistoryEntity::getId)
|
|
|
|
|
- .select(BusPumpHistoryEntity::getDeviceId)
|
|
|
|
|
- .eq(BusPumpHistoryEntity::getTenantId, clinic.getTenantId())
|
|
|
|
|
- .eq(BusPumpHistoryEntity::getPatientCode, clinic.getPatientCode())
|
|
|
|
|
- .le(requestId!=null, BusPumpHistoryEntity::getRequestId,requestId)
|
|
|
|
|
- .isNull(BusPumpHistoryEntity::getClinicId));
|
|
|
|
|
|
|
+ .select(BusDeviceHistoryEntity::getId)
|
|
|
|
|
+ .select(BusDeviceHistoryEntity::getDeviceId)
|
|
|
|
|
+ .eq(BusDeviceHistoryEntity::getTenantId, clinic.getTenantId())
|
|
|
|
|
+ .eq(BusDeviceHistoryEntity::getPatientCode, clinic.getPatientCode())
|
|
|
|
|
+ .le(requestId!=null, BusDeviceHistoryEntity::getRequestId,requestId)
|
|
|
|
|
+ .isNull(BusDeviceHistoryEntity::getClinicId));
|
|
|
if (CollectionUtil.isNotEmpty(historyList)) {
|
|
if (CollectionUtil.isNotEmpty(historyList)) {
|
|
|
//历史信息与临床号绑定
|
|
//历史信息与临床号绑定
|
|
|
historyList.forEach(history-> history.fillClinic(clinic));
|
|
historyList.forEach(history-> history.fillClinic(clinic));
|
|
|
historyService.updateBatchById(historyList);
|
|
historyService.updateBatchById(historyList);
|
|
|
- clinic.setDeviceCodes(historyList.stream().map(BusPumpHistoryEntity::getDeviceId).collect(Collectors.toSet()));
|
|
|
|
|
|
|
+ clinic.setDeviceCodes(historyList.stream().map(BusDeviceHistoryEntity::getDeviceId).collect(Collectors.toSet()));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
pumpService.update(new UpdateWrapper<BusDeviceUsingEntity>()
|
|
pumpService.update(new UpdateWrapper<BusDeviceUsingEntity>()
|