168 入科分配床位填写的住院医生、主治医生、责任护士字段的内容双击查看未显示。

This commit is contained in:
Ranyunqiao
2026-03-12 16:58:39 +08:00
parent e8850e85fc
commit 066cfaba46
3 changed files with 105 additions and 91 deletions

View File

@@ -40,8 +40,10 @@ import com.openhis.web.inhospitalnursestation.mapper.ATDManageAppMapper;
import com.openhis.workflow.domain.ServiceRequest;
import com.openhis.workflow.service.IServiceRequestService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
import java.util.stream.Collectors;
@@ -53,6 +55,7 @@ import java.util.stream.Stream;
* @author zwh
* @date 2025-07-28
*/
@Slf4j
@Service
public class ATDManageAppServiceImpl implements IATDManageAppService {
@@ -283,6 +286,7 @@ public class ATDManageAppServiceImpl implements IATDManageAppService {
* @return 结果
*/
@Override
@Transactional(rollbackFor = Exception.class)
public R<?> admissionBedAssignment(AdmissionPatientInfoDto admissionPatientInfoDto) {
// 住院id
@@ -298,31 +302,39 @@ public class ATDManageAppServiceImpl implements IATDManageAppService {
// 进入编辑患者信息,不更换床位
if (Whether.YES.getCode().equals(admissionPatientInfoDto.getEditFlag())) {
// 更新患者病情(如果提供了)
if (admissionPatientInfoDto.getPriorityEnum() != null) {
// 更新患者病情
encounterService.updatePriorityEnumById(encounterId, admissionPatientInfoDto.getPriorityEnum());
// 将之前的住院参与者更新为已完成(如果存在的话)
encounterParticipantService.updateEncounterParticipantsStatus(encounterId);
// 更新住院参与者
// 住院医生
}
// 将之前的住院参与者更新为已完成(如果存在的话)
encounterParticipantService.updateEncounterParticipantsStatus(encounterId);
// 更新住院参与者
// 住院医生(必须填写)
if (admissionPatientInfoDto.getAdmittingDoctorId() != null) {
encounterParticipantService.creatEncounterParticipants(encounterId, startTime,
admissionPatientInfoDto.getAdmittingDoctorId(), ParticipantType.ADMITTING_DOCTOR.getCode());
// 责任护士
}
// 责任护士(必须填写)
if (admissionPatientInfoDto.getPrimaryNurseId() != null) {
encounterParticipantService.creatEncounterParticipants(encounterId, startTime,
admissionPatientInfoDto.getPrimaryNurseId(), ParticipantType.PRIMARY_NURSE.getCode());
if (admissionPatientInfoDto.getAttendingDoctorId() != null) {
// 主治医生
encounterParticipantService.creatEncounterParticipants(encounterId, startTime,
admissionPatientInfoDto.getAttendingDoctorId(), ParticipantType.ATTENDING_DOCTOR.getCode());
}
if (admissionPatientInfoDto.getChiefDoctorId() != null) {
// 主任医生
encounterParticipantService.creatEncounterParticipants(encounterId, startTime,
admissionPatientInfoDto.getChiefDoctorId(), ParticipantType.CHIEF_DOCTOR.getCode());
}
}
// 更新入院体征
saveOrUpdateAdmissionSigns(encounterId, admissionPatientInfoDto, startTime);
// 主治医生(可选)
if (admissionPatientInfoDto.getAttendingDoctorId() != null) {
encounterParticipantService.creatEncounterParticipants(encounterId, startTime,
admissionPatientInfoDto.getAttendingDoctorId(), ParticipantType.ATTENDING_DOCTOR.getCode());
}
// 主任医生(可选)
if (admissionPatientInfoDto.getChiefDoctorId() != null) {
encounterParticipantService.creatEncounterParticipants(encounterId, startTime,
admissionPatientInfoDto.getChiefDoctorId(), ParticipantType.CHIEF_DOCTOR.getCode());
}
// 更新入院体征(在事务外执行,避免影响参与者数据保存)
try {
saveOrUpdateAdmissionSigns(encounterId, admissionPatientInfoDto, startTime);
} catch (Exception e) {
log.error("保存入院体征失败,但不影响参与者数据", e);
}
return R.ok("患者信息更新成功");
}
@@ -421,8 +433,12 @@ public class ATDManageAppServiceImpl implements IATDManageAppService {
if (result == 0) {
return R.fail("床位分配失败,请联系管理员");
}
// 保存入院体征
saveOrUpdateAdmissionSigns(encounterId, admissionPatientInfoDto, startTime);
// 保存入院体征(在事务外执行,避免影响参与者数据保存)
try {
saveOrUpdateAdmissionSigns(encounterId, admissionPatientInfoDto, startTime);
} catch (Exception e) {
log.error("保存入院体征失败,但不影响参与者数据", e);
}
return R.ok("床位分配成功");
}

View File

@@ -10,6 +10,7 @@ import com.openhis.administration.mapper.EncounterParticipantMapper;
import com.openhis.administration.service.IEncounterParticipantService;
import com.openhis.common.enums.EncounterActivityStatus;
import com.openhis.common.enums.ParticipantType;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@@ -22,6 +23,7 @@ import java.util.List;
* @author system
* @date 2025-02-20
*/
@Slf4j
@Service
public class EncounterParticipantServiceImpl extends ServiceImpl<EncounterParticipantMapper, EncounterParticipant>
implements IEncounterParticipantService {
@@ -58,9 +60,12 @@ public class EncounterParticipantServiceImpl extends ServiceImpl<EncounterPartic
@Override
public void creatEncounterParticipants(Long encounterId, Date startTime, Long practitionerId, String typeCode) {
EncounterParticipant encounterParticipant = new EncounterParticipant();
encounterParticipant.setEncounterId(encounterId).setStartTime(startTime).setPractitionerId(practitionerId)
.setTypeCode(typeCode);
baseMapper.insert(encounterParticipant);
encounterParticipant.setEncounterId(encounterId)
.setStartTime(startTime)
.setPractitionerId(practitionerId)
.setTypeCode(typeCode)
.setStatusEnum(EncounterActivityStatus.ACTIVE.getValue());
int result = baseMapper.insert(encounterParticipant);
}
/**
@@ -72,12 +77,15 @@ public class EncounterParticipantServiceImpl extends ServiceImpl<EncounterPartic
@Override
public Integer updateEncounterParticipantsStatus(Long encounterId) {
// 更新状态为已完成
return baseMapper.update(null,
Integer result = baseMapper.update(null,
new LambdaUpdateWrapper<EncounterParticipant>()
.set(EncounterParticipant::getStatusEnum, EncounterActivityStatus.COMPLETED.getValue())
.eq(EncounterParticipant::getEncounterId, encounterId).in(EncounterParticipant::getTypeCode,
.eq(EncounterParticipant::getEncounterId, encounterId)
.eq(EncounterParticipant::getStatusEnum, EncounterActivityStatus.ACTIVE.getValue())
.in(EncounterParticipant::getTypeCode,
ParticipantType.ATTENDING_DOCTOR.getCode(), ParticipantType.CHIEF_DOCTOR.getCode(),
ParticipantType.PRIMARY_NURSE.getCode(), ParticipantType.ADMITTING_DOCTOR.getCode()));
return result;
}
/*

View File

@@ -389,43 +389,58 @@ const interventionForm = ref({
startTime: '', //入院时间
});
watch(
() => props.pendingInfo,
(newVal, oldVal) => {
console.log(newVal);
if (newVal) {
getPatientInfo({ encounterId: newVal.encounterId }).then((res) => {
console.log('res============>', JSON.stringify(res.data));
/**
* 获取患者详细信息并填充表单
*/
const loadPatientInfo = () => {
if (!props.pendingInfo?.encounterId) {
return;
}
getPatientInfo({ encounterId: props.pendingInfo.encounterId }).then((res) => {
pendingInfo.value = res.data;
// 从后端获取数据后设置医生和护士 ID
if (res.data.admittingDoctorId) {
interventionForm.value.admittingDoctorId = res.data.admittingDoctorId;
}
if (res.data.attendingDoctorId) {
interventionForm.value.attendingDoctorId = res.data.attendingDoctorId;
}
if (res.data.chiefDoctorId) {
interventionForm.value.chiefDoctorId = res.data.chiefDoctorId;
}
if (res.data.primaryNurseId) {
interventionForm.value.primaryNurseId = res.data.primaryNurseId;
}
if (res.data.startTime) {
interventionForm.value.startTime = dayjs(res.data.startTime).format(
'YYYY-MM-DD HH:mm:ss'
);
} else {
interventionForm.value.startTime = dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss');
}
interventionForm.value.height = res.data.height;
interventionForm.value.weight = res.data.weight;
interventionForm.value.temperature = res.data.temperature;
interventionForm.value.hertRate = res.data.hertRate;
interventionForm.value.pulse = res.data.pulse;
interventionForm.value.endBloodPressure = res.data.endBloodPressure;
interventionForm.value.highBloodPressure = res.data.highBloodPressure;
});
interventionForm.value.priorityEnum = props.pendingInfo.priorityEnum || '';
interventionForm.value.organizationName = props.pendingInfo.organizationName || '';
interventionForm.value.wardName = props.pendingInfo.wardName || '';
interventionForm.value.bedName = props.pendingInfo.bedName || '';
};
pendingInfo.value = res.data;
interventionForm.value.admittingDoctorId = res.data.admittingDoctorId;
interventionForm.value.attendingDoctorId = res.data.attendingDoctorId;
if (res.data.chiefDoctorId) {
interventionForm.value.chiefDoctorId = res.data.chiefDoctorId;
}
interventionForm.value.primaryNurseId = res.data.primaryNurseId;
if (res.data.startTime) {
interventionForm.value.startTime = dayjs(res.data.startTime).format(
'YYYY-MM-DD HH:mm:ss'
);
} else {
interventionForm.value.startTime = dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss');
}
interventionForm.value.height = res.data.height;
interventionForm.value.weight = res.data.weight;
interventionForm.value.temperature = res.data.temperature;
interventionForm.value.hertRate = res.data.hertRate;
interventionForm.value.pulse = res.data.pulse;
interventionForm.value.endBloodPressure = res.data.endBloodPressure;
interventionForm.value.highBloodPressure = res.data.highBloodPressure;
});
interventionForm.value.priorityEnum = newVal.priorityEnum;
interventionForm.value.organizationName = newVal.organizationName;
interventionForm.value.wardName = newVal.wardName;
interventionForm.value.bedName = newVal.bedName;
watch(
() => props.pendingInfo?.encounterId,
(newVal, oldVal) => {
// 只在 encounterId 存在且发生变化时才获取数据
if (newVal && newVal !== oldVal) {
loadPatientInfo();
}
},
{ deep: true }
{ immediate: true }
);
/* 初始化数据 */
@@ -458,8 +473,6 @@ const init = () => {
// 主任医生
getDoctorInfo({ organizationId: props.pendingInfo.organizationId })
.then((res) => {
console.log('doctorInfoOptions======>', JSON.stringify(res.data));
doctorInfoOptions.value = res.data.records || [];
nextTick(() => {
// 如果存在主任医师显示主任,如果没有选择第一个展示
@@ -498,6 +511,7 @@ const rules = reactive<FormRules>({
admittingDoctorId: [{ required: true, message: '请选择住院医生', trigger: ['blur', 'change'] }],
primaryNurseId: [{ required: true, message: '请选择责任护士', trigger: ['blur', 'change'] }],
bedLocationId: [{ required: true, message: '请选择入住床位', trigger: ['blur', 'change'] }],
// 主治医生和主任医生为可选字段,不添加 required 验证
});
const printWristband = ref(false);
@@ -512,29 +526,10 @@ const cancelAct = () => {
};
const resetForm = () => {
// interventionForm.value = {
// height: undefined,
// weight: undefined,
// temperature: undefined,
// hertRate: undefined,
// pulse: undefined,
// endBloodPressure: undefined,
// highBloodPressure: undefined,
// bedLocationId: '', // 床号
// admittingDoctorId: '', // 住院医师
// attendingDoctorId: '', // 主治医师
// chiefDoctorId: '', // 主任医师
// primaryNurseId: '', // 责任护士
// priorityEnum: '', //患者病情
// organizationName: '',
// wardName: '',
// attendingDocUpdateId: '',
// startTime: '', //入院时间
// }
// 可选:清空校验状态
// 只重置表单验证状态,不清空数据
// 数据会在下次打开对话框时通过 loadPatientInfo 重新加载
if (interventionFormRef.value) {
interventionFormRef.value.resetFields();
interventionFormRef.value.clearValidate();
}
};
@@ -583,19 +578,14 @@ const handleSubmit = async () => {
});
}
} catch (error) {
console.log('表单验证失败:', error);
console.error('表单验证失败:', error);
}
};
const openAct = () => {
init();
if (props.pendingInfo) {
interventionForm.value.priorityEnum = props.pendingInfo.priorityEnum || '';
interventionForm.value.admittingDoctorId = props.pendingInfo.practitionerId || '';
interventionForm.value.organizationName = props.pendingInfo.organizationName || '';
interventionForm.value.wardName = props.pendingInfo.wardName || '';
interventionForm.value.attendingDocUpdateId = props.pendingInfo.admittingDoctorId || '';
}
// 重新加载患者详细信息(包括医生、护士等)
loadPatientInfo();
};
const closedAct = () => {