diff --git a/openhis-ui-vue3/src/views/charge/outpatientregistration/components/patientAddDialog.vue b/openhis-ui-vue3/src/views/charge/outpatientregistration/components/patientAddDialog.vue
index 203199351..36402d7f9 100755
--- a/openhis-ui-vue3/src/views/charge/outpatientregistration/components/patientAddDialog.vue
+++ b/openhis-ui-vue3/src/views/charge/outpatientregistration/components/patientAddDialog.vue
@@ -589,11 +589,11 @@ import {updatePatient} from '@/views/patientmanagement/patientmanagement/compone
import {getGenderAndAge, isValidCNidCardNumber, isValidCNPhoneNumber,} from '../../../../utils/validate';
import {ElMessage} from 'element-plus';
import {getConfigKey} from '@/api/system/config'; // 导入获取配置的方法
+import {getDicts} from '@/api/system/dict/data'; // 导入获取字典数据的方法
const router = useRouter();
const { proxy } = getCurrentInstance();
const {
- patient_gender_enum,
sys_idtype,
prfs_enum,
blood_rh,
@@ -603,7 +603,6 @@ const {
link_relation_code,
nationality_code,
} = proxy.useDict(
- 'patient_gender_enum',
'sys_idtype',
'prfs_enum',
'blood_rh',
@@ -634,14 +633,15 @@ const getPatientDerivedOptions = async () => {
try {
console.log('开始获取患者来源字典数据...');
// 从字典管理获取患者来源数据,字典类型为patient_derived
- const patientDerivedDict = await proxy.getDictDataByType('patient_derived');
- console.log('获取到的患者来源原始数据:', patientDerivedDict);
-
+ const response = await getDicts('patient_derived');
+ console.log('获取到的患者来源原始数据:', response);
+
// 确保数据是数组
- if (!Array.isArray(patientDerivedDict)) {
- console.error('患者来源数据格式错误,不是数组:', patientDerivedDict);
+ if (!response || response.code !== 200 || !Array.isArray(response.data)) {
+ console.error('患者来源数据格式错误:', response);
return;
}
+ const patientDerivedDict = response.data;
// 按字典排序字段(sort字段)升序排序
const sortedPatientDerived = patientDerivedDict.sort((a, b) => {
@@ -675,33 +675,20 @@ const getPatientDerivedOptions = async () => {
// 从字典管理获取性别数据
const getGenderOptions = async () => {
try {
- // 从字典管理获取性别数据
- const genderDict = await proxy.getDictDataByType('性别');
-
- // 去重:使用 Map 根据 value 去重
- const uniqueMap = new Map();
- genderDict.forEach(item => {
- if (!uniqueMap.has(item.value)) {
- uniqueMap.set(item.value, item);
- }
- });
- const uniqueGenders = Array.from(uniqueMap.values());
-
- // 按字典排序字段排序
- const sortedGenders = uniqueGenders.sort((a, b) => {
- return (a.sort || 0) - (b.sort || 0);
- });
-
- // 转换为组件需要的格式,确保 value 是字符串类型
- administrativegenderList.value = sortedGenders.map(item => ({
- value: String(item.value), // 确保值为字符串类型
- info: item.label // 使用字典标签
+ const response = await getDicts('gend');
+ if (!response || response.code !== 200 || !Array.isArray(response.data)) {
+ console.error('性别字典数据格式错误:', response);
+ return;
+ }
+ // 下拉显示标签(dictLabel),值用键值(dictValue)
+ administrativegenderList.value = response.data.map(item => ({
+ value: String(item.dictValue || item.value),
+ info: item.dictLabel || item.label
}));
-
console.log('性别字典数据加载完成:', administrativegenderList.value);
} catch (error) {
console.error('获取性别字典数据失败:', error);
- // 降级方案:使用默认的性别选项
+ // 降级方案
administrativegenderList.value = [
{ value: '1', info: '男' },
{ value: '2', info: '女' },
@@ -715,14 +702,15 @@ const getGenderOptions = async () => {
const getEducationLevelOptions = async () => {
try {
// 从字典管理获取文化程度数据
- const educationDict = await proxy.getDictDataByType('文化程度');
- console.log('获取到的文化程度数据:', educationDict);
-
+ const response = await getDicts('文化程度');
+ console.log('获取到的文化程度原始数据:', response);
+
// 确保数据是数组
- if (!Array.isArray(educationDict)) {
- console.error('文化程度数据格式错误,不是数组:', educationDict);
+ if (!response || response.code !== 200 || !Array.isArray(response.data)) {
+ console.error('文化程度数据格式错误:', response);
return;
}
+ const educationDict = response.data;
// 按字典编码顺序升序排列(根据截图显示,排序字段为字典编码)
const sortedEducation = educationDict.sort((a, b) => {
@@ -1646,9 +1634,12 @@ function setViewMode(isView) {
// 设置表单数据
function setFormData(rowData) {
+ // 查看模式不改变标题(setViewMode 已设置 '查看患者')
+ if (!isViewMode.value) {
+ title.value = '修改患者';
+ }
// 标记为编辑模式
isEditMode.value = true;
- title.value = '修改患者';
// 深拷贝数据以避免引用问题
form.value = JSON.parse(JSON.stringify(rowData));
diff --git a/openhis-ui-vue3/src/views/patientmanagement/outpatienrecords/index.vue b/openhis-ui-vue3/src/views/patientmanagement/outpatienrecords/index.vue
index 6eeaa1f3e..aa300227e 100755
--- a/openhis-ui-vue3/src/views/patientmanagement/outpatienrecords/index.vue
+++ b/openhis-ui-vue3/src/views/patientmanagement/outpatienrecords/index.vue
@@ -132,11 +132,18 @@
min-width="100"
/>
+ >
+
+
+
+
@@ -296,6 +296,7 @@ import {nextTick, ref} from 'vue';
import {useRoute} from 'vue-router';
import {useRouter} from 'vue-router';
import {addPatient, listPatient, lists, updatePatient} from './component/api';
+import {getDicts} from '@/api/system/dict/data';
import PatientAddDialog from '@/views/charge/outpatientregistration/components/patientAddDialog';
const route = useRoute();
@@ -323,7 +324,6 @@ const selectedOptions = ref([]); // v-model 绑定的选中值
const { proxy } = getCurrentInstance();
const {
- patient_gender_enum,
sys_idtype,
prfs_enum,
blood_rh,
@@ -333,7 +333,6 @@ const {
link_relation_code,
nationality_code,
} = proxy.useDict(
- 'patient_gender_enum',
'sys_idtype',
'prfs_enum',
'blood_rh',
@@ -343,6 +342,15 @@ const {
'link_relation_code',
'nationality_code'
);
+const genderDict = ref([]);
+getDicts('gend').then(response => {
+ if (response && response.code === 200 && Array.isArray(response.data)) {
+ genderDict.value = response.data.map(item => ({
+ value: String(item.dictValue || item.value),
+ label: item.dictLabel || item.label,
+ }));
+ }
+});
const data = reactive({
isViewMode: false,