根据床位查询入住人员

This commit is contained in:
aoli.qu 2023-11-06 10:30:02 +08:00
parent b2b9e68184
commit dab93717bf
5 changed files with 56 additions and 1 deletions

View File

@ -37,6 +37,7 @@ public interface BcHospitalRecordMapper extends BaseMapper<BcHospitalRecord> {
" <if test = 'type != null'> " +
" <choose> " +
/*查询入院记录*/
" <when test=\"type == 1\"> " +
" and a.check_out_time is null " +
" </when> " +
@ -62,6 +63,9 @@ public interface BcHospitalRecordMapper extends BaseMapper<BcHospitalRecord> {
" and a.room_id = #{roomId} " +
" </if>" +
" <if test = 'bedId != null '>" +
" and a.bed_id = #{bedId} " +
" </if>" +
" order by a.create_time desc " +
"</script>")

View File

@ -155,6 +155,28 @@ public class BcHospitalRecordService extends ServiceImpl<BcHospitalRecordMapper,
return null;
}
/**
* 根据床位查询入院记录
*/
public BcHospitalRecord getRecordByBedId(Long bedId) {
BcHospitalRecord record = new BcHospitalRecord();
record.setBedId(bedId);
record.setType(1);
List<BcHospitalRecord> bcHospitalRecords = baseMapper.checkList(record);
if (null != bcHospitalRecords && !bcHospitalRecords.isEmpty()) {
BcHospitalRecord hospitalRecord = bcHospitalRecords.get(0);
BcPersonSupport person = personSupportService.getById(hospitalRecord.getPersonId());
if (ObjectUtil.isNotNull(person)) {
hospitalRecord.setPersonName(person.getName());
}
return hospitalRecord;
}
return null;
}
/**
* 删除
*/

View File

@ -79,7 +79,7 @@ public interface BcPersonSupportMapper extends BaseMapper<BcPersonSupport> {
" and age BETWEEN 80 AND 89 " +
" </when> " +
" <when test=\"ageRange == 6\"> " +
" and age > 90 " +
" and age >= 90 " +
" </when> " +
" <otherwise> " +
" and 1=1 " +

View File

@ -1,6 +1,7 @@
package com.org.web.room.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.org.system.entity.BaseEntity;
@ -29,4 +30,16 @@ public class BcRoomBed extends BaseEntity {
*/
private Long roomId;
/**
* 入住人员id
*/
@TableField(exist = false)
private Long personId;
/**
* 人员名称
*/
@TableField(exist = false)
private String personName;
}

View File

@ -8,6 +8,8 @@ import com.org.system.enums.YesOrNoState;
import com.org.system.service.SysDataDictionaryItemService;
import com.org.utils.SecurityUtil;
import com.org.utils.exception.CustomException;
import com.org.web.hospital.domain.BcHospitalRecord;
import com.org.web.hospital.service.BcHospitalRecordService;
import com.org.web.room.domain.BcRoom;
import com.org.web.room.domain.BcRoomBed;
import com.org.web.room.mapper.BcRoomMapper;
@ -30,6 +32,9 @@ public class BcRoomService extends ServiceImpl<BcRoomMapper, BcRoom> {
@Autowired
SysDataDictionaryItemService sysDataDictionaryItemService;
@Autowired
BcHospitalRecordService hospitalRecordService;
/**
* 新增或编辑
*/
@ -67,6 +72,17 @@ public class BcRoomService extends ServiceImpl<BcRoomMapper, BcRoom> {
// 查询床位数据
List<BcRoomBed> roomBedList = bcRoomBedService.listByRoomId(id);
// 为供养房 查询入住信息
if (bcRoom.getRoomType() == 1) {
for (BcRoomBed roomBed : roomBedList) {
BcHospitalRecord recordByBedId = hospitalRecordService.getRecordByBedId(roomBed.getId());
if (null != recordByBedId) {
roomBed.setPersonId(recordByBedId.getPersonId());
roomBed.setPersonName(recordByBedId.getPersonName());
}
}
}
bcRoom.setRoomBedList(roomBedList);