|
@@ -305,8 +305,7 @@ public class LocalBusInfusionHistoryService extends BaseService<BusInfusionHisto
|
|
|
public BusInfusionHistoryEntity deviceOccupation(BusInfusionHistoryEntity lastInfusion) {
|
|
public BusInfusionHistoryEntity deviceOccupation(BusInfusionHistoryEntity lastInfusion) {
|
|
|
List<BusInfusionHistoryEntity> infusionHistories = this.list(new QueryWrapper<BusInfusionHistoryEntity>().lambda()
|
|
List<BusInfusionHistoryEntity> infusionHistories = this.list(new QueryWrapper<BusInfusionHistoryEntity>().lambda()
|
|
|
.eq(BusInfusionHistoryEntity::getFinished, false)
|
|
.eq(BusInfusionHistoryEntity::getFinished, false)
|
|
|
- .eq(BusInfusionHistoryEntity::getPatientId, lastInfusion.getPatientId())
|
|
|
|
|
- .eq(BusInfusionHistoryEntity::getTenantId, lastInfusion.getTenantId()));
|
|
|
|
|
|
|
+ .eq(BusInfusionHistoryEntity::getPatientId, lastInfusion.getPatientId()));
|
|
|
int size = CollectionUtil.size(infusionHistories);
|
|
int size = CollectionUtil.size(infusionHistories);
|
|
|
if(size>0){
|
|
if(size>0){
|
|
|
lastInfusion = infusionHistories.stream()
|
|
lastInfusion = infusionHistories.stream()
|
|
@@ -315,7 +314,6 @@ public class LocalBusInfusionHistoryService extends BaseService<BusInfusionHisto
|
|
|
|
|
|
|
|
patientService.update(new UpdateWrapper<BusPatientEntity>().lambda()
|
|
patientService.update(new UpdateWrapper<BusPatientEntity>().lambda()
|
|
|
.eq(BusPatientEntity::getId,lastInfusion.getPatientId())
|
|
.eq(BusPatientEntity::getId,lastInfusion.getPatientId())
|
|
|
- .eq(BusPatientEntity::getTenantId,lastInfusion.getTenantId())
|
|
|
|
|
.set(BusPatientEntity::getInfusionId,lastInfusion.getId())
|
|
.set(BusPatientEntity::getInfusionId,lastInfusion.getId())
|
|
|
.set(size==0,BusPatientEntity::getAlarm, PatientAlarmEnum.DEVICE_NONE)
|
|
.set(size==0,BusPatientEntity::getAlarm, PatientAlarmEnum.DEVICE_NONE)
|
|
|
.set(size==1,BusPatientEntity::getAlarm, PatientAlarmEnum.NONE)
|
|
.set(size==1,BusPatientEntity::getAlarm, PatientAlarmEnum.NONE)
|
|
@@ -323,44 +321,6 @@ public class LocalBusInfusionHistoryService extends BaseService<BusInfusionHisto
|
|
|
return lastInfusion;
|
|
return lastInfusion;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 描述: 对设备关机进行处理
|
|
|
|
|
- * @author lifang
|
|
|
|
|
- * @date 2022/5/31 11:32
|
|
|
|
|
- * @param tenantId 医院id
|
|
|
|
|
- * @param patientCode 病号
|
|
|
|
|
- * @param infusionId 关机的输注id
|
|
|
|
|
- * @return void
|
|
|
|
|
- */
|
|
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
- public BusInfusionHistoryEntity deviceShutDown(String infusionId, String patientCode, String tenantId) {
|
|
|
|
|
- List<BusInfusionHistoryEntity> infusionHistories = this.list(new QueryWrapper<BusInfusionHistoryEntity>().lambda()
|
|
|
|
|
- .ne(BusInfusionHistoryEntity::getId,infusionId)
|
|
|
|
|
- .eq(BusInfusionHistoryEntity::getFinished, false)
|
|
|
|
|
- .eq(BusInfusionHistoryEntity::getPatientCode, patientCode)
|
|
|
|
|
- .eq(BusInfusionHistoryEntity::getTenantId,tenantId));
|
|
|
|
|
- int size = CollectionUtil.size(infusionHistories);
|
|
|
|
|
- BusInfusionHistoryEntity lastInfusion=null;
|
|
|
|
|
- LambdaUpdateWrapper<BusPatientEntity> updateWrapper = new UpdateWrapper<BusPatientEntity>().lambda()
|
|
|
|
|
- .eq(BusPatientEntity::getCode, patientCode)
|
|
|
|
|
- .eq(BusPatientEntity::getTenantId, tenantId)
|
|
|
|
|
- .set(size == 0, BusPatientEntity::getAlarm, PatientAlarmEnum.DEVICE_NONE)
|
|
|
|
|
- .set(size == 1, BusPatientEntity::getAlarm, PatientAlarmEnum.NONE)
|
|
|
|
|
- .set(size > 1, BusPatientEntity::getAlarm, PatientAlarmEnum.DEVICE_REPEAT);
|
|
|
|
|
- if(size>0){
|
|
|
|
|
- infusionHistories
|
|
|
|
|
- .stream()
|
|
|
|
|
- .max(Comparator.comparing(BusInfusionHistoryEntity::getStartTime))
|
|
|
|
|
- .map(infusion->{
|
|
|
|
|
- updateWrapper .set(BusPatientEntity::getInfusionId, infusion.getId());
|
|
|
|
|
- return infusion;
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- patientService.update(updateWrapper);
|
|
|
|
|
- return lastInfusion;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
public IPage<CombineResult> queryPage(CombineQuery query, Page<CombineResult> page) {
|
|
public IPage<CombineResult> queryPage(CombineQuery query, Page<CombineResult> page) {
|
|
|
return this.baseMapper.queryPage(query,page);
|
|
return this.baseMapper.queryPage(query,page);
|
|
|
}
|
|
}
|