From b26ad75299681e69fd64c8ade74bfbdf582b0166 Mon Sep 17 00:00:00 2001 From: sindir Date: Tue, 10 Mar 2026 16:33:47 +0800 Subject: [PATCH] =?UTF-8?q?151=20=E9=97=A8=E8=AF=8A=E5=8C=BB=E7=94=9F?= =?UTF-8?q?=E7=AB=99=E7=9A=84=E8=AF=8A=E6=96=ADTAB=E9=A1=B5=E9=80=9A?= =?UTF-8?q?=E8=BF=87=E7=BB=B4=E6=8A=A4=E7=9A=84=E4=B8=AA=E4=BA=BA/?= =?UTF-8?q?=E7=A7=91=E5=AE=A4=E8=AF=8A=E6=96=AD=E5=86=85=E5=AE=B9=E5=8F=8C?= =?UTF-8?q?=E5=87=BB=E5=BC=80=E5=8D=95=E8=AF=8A=E6=96=AD=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=98=BE=E7=A4=BA=E6=95=B0=E5=AD=9711?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/enums/ybenums/YbDiagType.java | 16 ++- openhis-ui-vue3/src/utils/medicalConstants.js | 109 ++++++++++++++++++ .../diagnosis/addDiagnosisDialog.vue | 10 +- .../components/diagnosis/diagnosis.vue | 20 ++-- 4 files changed, 143 insertions(+), 12 deletions(-) create mode 100644 openhis-ui-vue3/src/utils/medicalConstants.js diff --git a/openhis-server-new/openhis-common/src/main/java/com/openhis/common/enums/ybenums/YbDiagType.java b/openhis-server-new/openhis-common/src/main/java/com/openhis/common/enums/ybenums/YbDiagType.java index 51ebbddb..3592e4f8 100644 --- a/openhis-server-new/openhis-common/src/main/java/com/openhis/common/enums/ybenums/YbDiagType.java +++ b/openhis-server-new/openhis-common/src/main/java/com/openhis/common/enums/ybenums/YbDiagType.java @@ -28,7 +28,19 @@ public enum YbDiagType { /** * 中医主证诊断 */ - TCM_MAIN_SYNDROME_DIAGNOSIS(3, "中医主证诊断"); + TCM_MAIN_SYNDROME_DIAGNOSIS(3, "中医主证诊断"), + /** + * 初诊诊断 + */ + INITIAL_DIAGNOSIS(4, "初诊诊断"), + /** + * 修正诊断 + */ + REVISED_DIAGNOSIS(5, "修正诊断"), + /** + * 补充诊断 + */ + SUPPLEMENTARY_DIAGNOSIS(6, "补充诊断"); private Integer value; private String description; @@ -38,7 +50,7 @@ public enum YbDiagType { return null; } for (YbDiagType val : values()) { - if (val.getValue().equals(value)) { + if (val.getValue().toString().equals(value)) { return val; } } diff --git a/openhis-ui-vue3/src/utils/medicalConstants.js b/openhis-ui-vue3/src/utils/medicalConstants.js new file mode 100644 index 00000000..d3416870 --- /dev/null +++ b/openhis-ui-vue3/src/utils/medicalConstants.js @@ -0,0 +1,109 @@ +/** + * 医疗常量配置 + * 从字典动态获取常量值,避免硬编码 + * + * 使用方式: + * import { DIAG_TYPE } from '@/utils/medicalConstants'; + * medTypeCode: DIAG_TYPE.WESTERN_MEDICINE + */ + +import { getDicts } from '@/api/system/dict/data'; + +// 诊断类型字典缓存 +let diagTypeCache = null; + +/** + * 获取诊断类型字典(异步初始化) + */ +async function initDiagType() { + if (!diagTypeCache) { + try { + const res = await getDicts('diag_type'); + diagTypeCache = res.data || []; + } catch (error) { + console.error('获取诊断类型字典失败:', error); + diagTypeCache = []; + } + } + return diagTypeCache; +} + +/** + * 根据标签获取诊断类型的值 + * @param {string} label - 诊断类型标签,如 '西医诊断' + * @returns {string|null} - 诊断类型的值,如 '1' + */ +export async function getDiagTypeValue(label) { + const dictList = await initDiagType(); + const item = dictList.find(d => d.dictLabel === label); + return item ? item.dictValue : null; +} + +/** + * 根据值获取诊断类型的标签 + * @param {string} value - 诊断类型的值,如 '1' + * @returns {string|null} - 诊断类型的标签,如 '西医诊断' + */ +export async function getDiagTypeLabel(value) { + const dictList = await initDiagType(); + const item = dictList.find(d => d.dictValue === value); + return item ? item.dictLabel : null; +} + +/** + * 获取完整的诊断类型字典列表 + * @returns {Array} - 诊断类型字典列表 + */ +export async function getDiagTypeList() { + return await initDiagType(); +} + +/** + * 诊断类型常量(同步使用,需要先初始化字典) + * 注意:这些值在字典加载后才有效 + */ +export const DIAG_TYPE = { + /** 西医诊断 */ + WESTERN_MEDICINE: '1', + /** 中医主病诊断 */ + TCM_MAIN_DISEASE: '2', + /** 中医主证诊断 */ + TCM_MAIN_SYNDROME: '3', + /** 初诊诊断 */ + INITIAL: '4', + /** 修正诊断 */ + REVISED: '5', + /** 补充诊断 */ + SUPPLEMENTARY: '6', +}; + +/** + * 诊断类型常量的说明信息 + */ +export const DIAG_TYPE_DESCRIPTIONS = { + '1': '西医诊断', + '2': '中医主病诊断', + '3': '中医主证诊断', + '4': '初诊诊断', + '5': '修正诊断', + '6': '补充诊断', +}; + +/** + * 获取诊断类型的说明 + * @param {string} value - 诊断类型的值 + * @returns {string} - 说明信息 + */ +export function getDiagTypeDescription(value) { + return DIAG_TYPE_DESCRIPTIONS[value] || '未知类型'; +} + +// 默认导出 +export default { + DIAG_TYPE, + DIAG_TYPE_DESCRIPTIONS, + getDiagTypeValue, + getDiagTypeLabel, + getDiagTypeList, + getDiagTypeDescription, +}; diff --git a/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/addDiagnosisDialog.vue b/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/addDiagnosisDialog.vue index 299ccfae..dc230023 100644 --- a/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/addDiagnosisDialog.vue +++ b/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/addDiagnosisDialog.vue @@ -94,6 +94,7 @@ import { updateTcmDiagnosis, getTcmDiagnosis, } from '@/views/doctorstation/components/api'; +import { DIAG_TYPE } from '@/utils/medicalConstants'; const props = defineProps({ openAddDiagnosisDialog: { @@ -120,6 +121,11 @@ const selectedDisease = ref(false); const { proxy } = getCurrentInstance(); const emit = defineEmits(['close']); + + +// 获取诊断类型字典 +const { diag_type } = proxy.useDict('diag_type'); + function handleOpen() { // 获取诊断列表 getTcmCondition().then((res) => { @@ -227,7 +233,7 @@ function handleClickRow(row) { ybNo: row.ybNo, syndromeGroupNo: timestamp.value, verificationStatusEnum: 4, - medTypeCode: undefined, // 不设默认值 + medTypeCode: DIAG_TYPE.TCM_MAIN_DISEASE, // 诊断类型:中医主病诊断 (值:2) isExisting: false // 标记为新增 }); tcmDiagonsisList.value.push({ @@ -255,6 +261,7 @@ function clickSyndromeRow(row) { definitionId: row.id, ybNo: row.ybNo, syndromeGroupNo: timestamp.value, + medTypeCode: DIAG_TYPE.TCM_MAIN_SYNDROME, // 诊断类型:中医主证诊断 (值:3) isExisting: false // 标记为新增 }); tcmDiagonsisList.value[tcmDiagonsisList.value.length - 1].syndromeName = row.name; @@ -381,7 +388,6 @@ function close() { gap: 20px; margin-bottom: 25px; } - .disease-section, .syndrome-section, .diagnosis-section { diff --git a/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/diagnosis.vue b/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/diagnosis.vue index 086cfaa2..0044a18d 100644 --- a/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/diagnosis.vue +++ b/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/diagnosis.vue @@ -100,7 +100,7 @@ item.diagSrtNo)); const tcmRes = await getTcmDiagnosis({ encounterId: props.patientInfo.encounterId }); if (tcmRes.code == 200) { if (tcmRes.data.illness.length > 0) { tcmRes.data.illness.forEach((item, index) => { - if (item.diagSrtNo <= maxNo) { + // 如果该排序号的诊断已存在,则跳过(避免重复添加) + if (existingDiagSrtNoSet.has(item.diagSrtNo)) { return; } form.value.diagnosisList.push({ @@ -363,7 +366,8 @@ async function getList() { symptomDefinitionId : tcmRes.data.symptom[index].definitionId, symptomYbNo: tcmRes.data.symptom[index].ybNo, }); - maxNo = item.diagSrtNo; + // 添加后更新集合 + existingDiagSrtNoSet.add(item.diagSrtNo); }); } emits('diagnosisSave', false); @@ -402,7 +406,7 @@ function handleImport() { form.value.diagnosisList.push({ ...item, ...{ - medTypeCode: '140104', + medTypeCode: DIAG_TYPE.WESTERN_MEDICINE, // 诊断类型:西医诊断 (值:1) verificationStatusEnum: 4, definitionId: item.id, diagSrtNo: maxSortNo + index + 1, @@ -508,7 +512,7 @@ function handleAddDiagnosis() { showPopover: false, name: undefined, verificationStatusEnum: 4, - medTypeCode: '11', + medTypeCode: DIAG_TYPE.WESTERN_MEDICINE, // 诊断类型:西医诊断 (值:1) diagSrtNo: maxSortNo + 1, iptDiseTypeCode: 2, diagnosisDesc: '', @@ -770,7 +774,7 @@ form.value.diagnosisList.push({ ybNo: data.ybNo, name: data.name, verificationStatusEnum: 4, - medTypeCode: '11', + medTypeCode: DIAG_TYPE.WESTERN_MEDICINE, // 诊断类型:西医诊断 (值:1) diagSrtNo: maxSortNo + 1, definitionId: data.definitionId, classification: '西医', // 默认为西医