From 4e84ea969abce59d6845153bfbfc909d7c3a5c62 Mon Sep 17 00:00:00 2001
From: wangjian963 <15215920+aprilry@user.noreply.gitee.com>
Date: Wed, 3 Jun 2026 16:47:32 +0800
Subject: [PATCH] =?UTF-8?q?=E2=97=8F=20fix(patient):=20=E4=BF=AE=E5=A4=8D?=
=?UTF-8?q?=E6=80=A7=E5=88=AB=E6=98=BE=E7=A4=BA&=E5=AD=97=E5=85=B8?=
=?UTF-8?q?=E8=8E=B7=E5=8F=96=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BC=98=E5=8C=96?=
=?UTF-8?q?=E6=82=A3=E8=80=85=E5=BC=B9=E7=AA=97=E6=A0=87=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 修复 patientAddDialog 中 proxy.getDictDataByType is not a function 错误,
改用 getDicts('gend') 获取性别字典数据
- 修复患者列表性别字段显示数字问题:outpatienrecords 补装性别字典,
patientmanagement 增加 {dictValue,dictLabel}→{value,label} 格式转换
- 清理未使用的 patient_gender_enum 枚举引用
- 修复查看/编辑弹窗标题始终显示"修改患者":setFormData 查看模式下
不再覆盖 setViewMode 设置的标题
---
.../components/patientAddDialog.vue | 63 ++++++++-----------
.../outpatienrecords/index.vue | 12 +++-
.../patientmanagement/index.vue | 14 ++++-
3 files changed, 48 insertions(+), 41 deletions(-)
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,