@@ -10,7 +10,6 @@
|
||||
ref="registerRef"
|
||||
label-width="80px"
|
||||
:rules="rules"
|
||||
:disabled="props.isRegistered"
|
||||
>
|
||||
<el-row :gutter="8">
|
||||
<el-col :span="6">
|
||||
@@ -29,7 +28,6 @@
|
||||
clearable
|
||||
style="width: 100%"
|
||||
v-model="submitForm.inHospitalOrgId"
|
||||
:disabled="props.isRegistered"
|
||||
filterable
|
||||
:data="organization"
|
||||
:props="{
|
||||
@@ -49,11 +47,7 @@
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="入院病区" prop="wardLocationId">
|
||||
<el-select
|
||||
:disabled="props.isRegistered || !submitForm.inHospitalOrgId"
|
||||
v-model="submitForm.wardLocationId"
|
||||
placeholder="请先选择入院科室"
|
||||
>
|
||||
<el-select :disabled="props.alreadyEdit" v-model="submitForm.wardLocationId">
|
||||
<el-option
|
||||
v-for="item in wardListOptions"
|
||||
:key="item.id"
|
||||
@@ -80,7 +74,6 @@
|
||||
<el-form-item label="诊断类别" prop="medTypeCode">
|
||||
<el-select
|
||||
v-model="submitForm.medTypeCode"
|
||||
:disabled="props.isRegistered"
|
||||
placeholder="诊断类别"
|
||||
clearable
|
||||
filterable
|
||||
@@ -108,7 +101,6 @@
|
||||
<el-form-item label="入院诊断" prop="diagnosisDefinitionId">
|
||||
<el-select
|
||||
v-model="submitForm.diagnosisDefinitionId"
|
||||
:disabled="props.isRegistered"
|
||||
placeholder="入院诊断"
|
||||
clearable
|
||||
filterable
|
||||
@@ -132,11 +124,11 @@
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="患者病情">
|
||||
<el-select v-model="submitForm.priorityEnum" :disabled="props.isRegistered">
|
||||
<el-select v-model="submitForm.priorityEnum">
|
||||
<el-option
|
||||
v-for="item in props.initOptions.priorityLevelOptionOptions"
|
||||
v-for="item in props.initOptions.priorityEnumList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:label="item.info"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
@@ -144,7 +136,7 @@
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="入院类型" prop="admitSourceCode">
|
||||
<el-select v-model="submitForm.admitSourceCode" :disabled="props.isRegistered">
|
||||
<el-select v-model="submitForm.admitSourceCode">
|
||||
<el-option
|
||||
v-for="item in admit_source_code"
|
||||
:key="item.value"
|
||||
@@ -156,7 +148,7 @@
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="入院方式" prop="inWayCode">
|
||||
<el-select v-model="submitForm.inWayCode" :disabled="props.isRegistered">
|
||||
<el-select v-model="submitForm.inWayCode">
|
||||
<el-option
|
||||
v-for="item in in_way_code"
|
||||
:key="item.value"
|
||||
@@ -172,7 +164,6 @@
|
||||
v-model="submitForm.contractNo"
|
||||
placeholder="费用性质"
|
||||
clearable
|
||||
:disabled="props.isRegistered"
|
||||
@change="getValue"
|
||||
>
|
||||
<el-option
|
||||
@@ -188,7 +179,6 @@
|
||||
<el-form-item label="入院日期" prop="startTime">
|
||||
<el-date-picker
|
||||
v-model="submitForm.startTime"
|
||||
:disabled="props.isRegistered"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
type="date"
|
||||
placeholder="请选择日期"
|
||||
@@ -208,7 +198,6 @@ import {
|
||||
getBedInfo,
|
||||
getContractList,
|
||||
getDiagnosisDefinitionList,
|
||||
getProvincesAndCities,
|
||||
} from './api';
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { in_way_code, admit_source_code, med_type } = proxy.useDict(
|
||||
@@ -235,7 +224,7 @@ const props = defineProps({
|
||||
require: true,
|
||||
default: () => ({}),
|
||||
},
|
||||
isRegistered: {
|
||||
alreadyEdit: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
@@ -250,7 +239,6 @@ const wardListOptions = ref([]);
|
||||
const contractList = ref([]);
|
||||
const verificationStatusOptions = ref([]);
|
||||
const diagnosisDefinitionList = ref([]);
|
||||
const wardLoading = ref(false);
|
||||
const rules = reactive({
|
||||
inHospitalOrgId: [
|
||||
{
|
||||
@@ -280,52 +268,15 @@ const rules = reactive({
|
||||
trigger: ['blur', 'change'],
|
||||
},
|
||||
],
|
||||
// diagnosisDesc: [
|
||||
// {
|
||||
// required: true,
|
||||
// message: '诊断描述未填写',
|
||||
// trigger: ['blur', 'change'],
|
||||
// },
|
||||
// ],
|
||||
diagnosisDesc: [
|
||||
{
|
||||
required: true,
|
||||
message: '诊断描述未填写',
|
||||
trigger: ['blur', 'change'],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
//获取省市医保字符串
|
||||
const medicalInsuranceTitle = ref('');
|
||||
|
||||
// 暴露给父组件使用
|
||||
// defineExpose({
|
||||
// medicalInsuranceTitle,
|
||||
// });
|
||||
const getProvincesAndCitiesInfo = async () => {
|
||||
try {
|
||||
if (inHospitalInfo.encounterId) {
|
||||
const res = await getProvincesAndCities(props.inHospitalInfo.encounterId);
|
||||
// console.log('获取省市医保字符串', res);
|
||||
if (res && res.code == 200) {
|
||||
// 确保有数据时才更新
|
||||
medicalInsuranceTitle.value = res.data?.insutype || res.data || '';
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
// 静默处理错误,确保页面不会显示错误信息
|
||||
console.error('获取医保省市信息失败:', error);
|
||||
}
|
||||
};
|
||||
onMounted(() => {
|
||||
getProvincesAndCitiesInfo();
|
||||
});
|
||||
|
||||
// 监听inHospitalInfo.encounterId的变化,在弹窗打开时重新调用接口
|
||||
watch(
|
||||
() => props.inHospitalInfo.encounterId,
|
||||
(newEncounterId) => {
|
||||
if (newEncounterId) {
|
||||
getProvincesAndCitiesInfo();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
/* 提交表单 */
|
||||
const submitForm = reactive({
|
||||
inHospitalOrgId: props.inHospitalInfo.inHospitalOrgId,
|
||||
@@ -338,50 +289,25 @@ const submitForm = reactive({
|
||||
ambDiagnosisName: props.inHospitalInfo.ambDiagnosisName,
|
||||
medTypeCode: '21',
|
||||
});
|
||||
// /* 科室 病区 */
|
||||
// watch(
|
||||
// () => submitForm.inDocterWorkGroupCode,
|
||||
// (newValue) => {
|
||||
// if (newValue) {
|
||||
// if (newValue == '') {
|
||||
// submitForm.wardLocationId = '';
|
||||
// }
|
||||
// } else {
|
||||
// submitForm.wardLocationId = '';
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
|
||||
// watch(
|
||||
// () => submitForm.inNurseDeptCode,
|
||||
// (newValue) => {
|
||||
// if (newValue) {
|
||||
// getBedInfo(newValue);
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
/* 科室 病区 */
|
||||
watch(
|
||||
() => submitForm.wardLocationId,
|
||||
(newWardId) => {
|
||||
if (newWardId && wardListOptions.value.length > 0) {
|
||||
const selectedWard = wardListOptions.value.find((item) => item.id === newWardId);
|
||||
if (selectedWard) {
|
||||
handleWardClick(selectedWard);
|
||||
() => submitForm.inDocterWorkGroupCode,
|
||||
(newValue) => {
|
||||
if (newValue) {
|
||||
if (newValue == '') {
|
||||
submitForm.wardLocationId = '';
|
||||
}
|
||||
} else {
|
||||
submitForm.totalBedsNum = undefined;
|
||||
submitForm.idleBedsNum = undefined;
|
||||
submitForm.wardLocationId = '';
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
}
|
||||
);
|
||||
|
||||
watch(
|
||||
() => props.isRegistered,
|
||||
(newVal) => {
|
||||
if (newVal) {
|
||||
// 已登记状态可以做一些数据锁定操作
|
||||
} else {
|
||||
init();
|
||||
() => submitForm.inNurseDeptCode,
|
||||
(newValue) => {
|
||||
if (newValue) {
|
||||
getBedInfo(newValue);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -389,51 +315,25 @@ watch(
|
||||
onMounted(() => {
|
||||
getInitOptions();
|
||||
setValue();
|
||||
setDefaultAdmitSource();
|
||||
if (submitForm.inHospitalOrgId) {
|
||||
handleNodeClick({ id: submitForm.inHospitalOrgId });
|
||||
}
|
||||
});
|
||||
const setDefaultAdmitSource = () => {
|
||||
if (props.noFile) return;
|
||||
const defaultItem = admit_source_code.value.find((item) => item.value === '1');
|
||||
if (defaultItem) {
|
||||
submitForm.admitSourceCode = props.inHospitalInfo?.admitSourceCode || defaultItem.value;
|
||||
}
|
||||
};
|
||||
|
||||
function handleWardClick(item) {
|
||||
submitForm.wardBusNo = item.busNo;
|
||||
submitForm.totalBedsNum = undefined;
|
||||
submitForm.idleBedsNum = undefined;
|
||||
getBedInfo(submitForm.wardBusNo)
|
||||
.then((res) => {
|
||||
if (res.data) {
|
||||
submitForm.totalBedsNum = res.data.totalBedsNum;
|
||||
submitForm.idleBedsNum = res.data.idleBedsNum;
|
||||
} else {
|
||||
submitForm.totalBedsNum = 0;
|
||||
submitForm.idleBedsNum = 0;
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error('查询病床失败:', err);
|
||||
submitForm.totalBedsNum = undefined;
|
||||
submitForm.idleBedsNum = undefined;
|
||||
});
|
||||
getBedInfo(submitForm.wardBusNo).then((res) => {
|
||||
submitForm.totalBedsNum = res.data.totalBedsNum;
|
||||
submitForm.idleBedsNum = res.data.idleBedsNum;
|
||||
});
|
||||
}
|
||||
|
||||
function getInitOptions() {
|
||||
getOrgList().then((res) => {
|
||||
// organization.value = res.data.records
|
||||
organization.value = res.data.records[0].children.filter(
|
||||
(record) => record.typeEnum === 2 && record.classEnum === 2
|
||||
);
|
||||
organization.value = res.data.records;
|
||||
});
|
||||
// if (!props.noFile) {
|
||||
// wardList().then((res) => {
|
||||
// wardListOptions.value = res.data;
|
||||
// });
|
||||
// }
|
||||
if (!props.noFile) {
|
||||
wardList().then((res) => {
|
||||
wardListOptions.value = res.data;
|
||||
});
|
||||
}
|
||||
diagnosisInit().then((res) => {
|
||||
verificationStatusOptions.value = res.data.verificationStatusOptions;
|
||||
});
|
||||
@@ -450,40 +350,15 @@ function getDiagnosisInfo(value) {
|
||||
}
|
||||
|
||||
function handleNodeClick(orgInfo) {
|
||||
submitForm.wardLocationId = undefined; // 切换科室时,先清空原有病区
|
||||
submitForm.totalBedsNum = undefined;
|
||||
submitForm.idleBedsNum = undefined;
|
||||
wardListOptions.value = []; // 先清空列表,避免旧数据残留
|
||||
wardLoading.value = true;
|
||||
wardList({ orgId: orgInfo.id })
|
||||
.then((res) => {
|
||||
wardListOptions.value = res.data || [];
|
||||
if (wardListOptions.value.length > 0 && !props.inHospitalInfo.wardLocationId) {
|
||||
submitForm.wardLocationId = wardListOptions.value[0].id;
|
||||
const defaultWard = wardListOptions.value.find(
|
||||
(item) => item.id === submitForm.wardLocationId
|
||||
);
|
||||
if (defaultWard) {
|
||||
handleWardClick(defaultWard);
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error('加载病区失败:', err);
|
||||
wardListOptions.value = [];
|
||||
})
|
||||
.finally(() => {
|
||||
wardLoading.value = false;
|
||||
});
|
||||
wardList({ orgId: orgInfo.id }).then((res) => {
|
||||
wardListOptions.value = res.data;
|
||||
});
|
||||
}
|
||||
|
||||
function handleChange(value) {
|
||||
if (!value) {
|
||||
wardListOptions.value = [];
|
||||
submitForm.wardLocationId = undefined;
|
||||
submitForm.totalBedsNum = undefined;
|
||||
submitForm.idleBedsNum = undefined;
|
||||
wardLoading.value = false; // 同步停止加载
|
||||
}
|
||||
}
|
||||
|
||||
@@ -510,7 +385,7 @@ function setValue() {
|
||||
submitForm.ambDiagnosisName = props.inHospitalInfo?.ambDiagnosisName;
|
||||
submitForm.priorityEnum = props.inHospitalInfo?.priorityEnum;
|
||||
submitForm.priorityEnum_enumText = props.inHospitalInfo?.priorityEnum_enumText;
|
||||
// submitForm.admitSourceCode = props.inHospitalInfo?.admitSourceCode;
|
||||
submitForm.admitSourceCode = props.inHospitalInfo?.admitSourceCode;
|
||||
submitForm.admitSourceCode_dictText = props.inHospitalInfo?.admitSourceCode_dictText;
|
||||
submitForm.inWayCode = props.inHospitalInfo?.inWayCode;
|
||||
submitForm.inWayCode_dictText = props.inHospitalInfo?.inWayCode_dictText;
|
||||
@@ -531,13 +406,10 @@ const validateData = async (callback) => {
|
||||
};
|
||||
|
||||
const init = () => {
|
||||
if (!props.isRegistered) {
|
||||
// 只有待登记状态才重置
|
||||
submitForm.inDocterWorkGroupCode = '';
|
||||
submitForm.wardLocationId = '';
|
||||
}
|
||||
submitForm.inDocterWorkGroupCode = '';
|
||||
submitForm.wardLocationId = '';
|
||||
};
|
||||
defineExpose({ validateData, submitForm, init, medicalInsuranceTitle });
|
||||
defineExpose({ validateData, submitForm, init });
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.registerForm-container {
|
||||
|
||||
Reference in New Issue
Block a user