Merge remote-tracking branch 'origin/develop' into guanyu
This commit is contained in:
@@ -83,6 +83,7 @@
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
:disabled="hasUnsavedDiagnosis"
|
||||
@click="handleAddDiagnosis()"
|
||||
>
|
||||
新增诊断
|
||||
@@ -98,12 +99,19 @@
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
:disabled="hasUnsavedDiagnosis"
|
||||
@click="handleImport()"
|
||||
>
|
||||
导入慢性病诊断
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="hasUnsavedDiagnosis"
|
||||
class="unsaved-diagnosis-tip"
|
||||
>
|
||||
<el-icon><WarningFilled /></el-icon> 当前有未保存的诊断,请先保存后再新增
|
||||
</div>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
@@ -377,7 +385,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {getCurrentInstance, ref, watch} from 'vue'; // 添加 nextTick 导入
|
||||
import {getCurrentInstance, ref, computed, watch} from 'vue'; // 添加 nextTick 导入
|
||||
import useUserStore from '@/store/modules/user';
|
||||
import {
|
||||
delEncounterDiagnosis,
|
||||
@@ -414,6 +422,13 @@ const syndromeOptions = ref([]);
|
||||
const form = ref({
|
||||
diagnosisList: [],
|
||||
});
|
||||
|
||||
// 计算属性:是否有未保存的新诊断
|
||||
const hasUnsavedDiagnosis = computed(() => {
|
||||
return (form.value.diagnosisList || []).some(
|
||||
(item) => !item.conditionId && !item.encounterDiagnosisId
|
||||
);
|
||||
});
|
||||
const props = defineProps({
|
||||
patientInfo: {
|
||||
type: Object,
|
||||
@@ -555,6 +570,7 @@ function getList() {
|
||||
conditionId: item.conditionId || '',
|
||||
encounterDiagnosisId: item.encounterDiagnosisId || '',
|
||||
syndromeGroupNo: item.syndromeGroupNo || res.data.symptom[index]?.syndromeGroupNo || '',
|
||||
illnessName: item.name, // 保存原始疾病名称,避免保存时发送合并名称
|
||||
name: item.name + '-' + (res.data.symptom[index]?.name || ''),
|
||||
ybNo: item.ybNo,
|
||||
definitionId: item.definitionId || '',
|
||||
@@ -999,9 +1015,14 @@ function handleSaveDiagnosis() {
|
||||
|
||||
// 再逐个保存中医诊断(只追加,不清空)
|
||||
for (const item of tcmList) {
|
||||
const syndromeGroupNo = item.conditionId
|
||||
? `${item.conditionId}-${item.tcmSyndromeCode || Date.now()}`
|
||||
: `${Date.now()}-${item.tcmSyndromeCode || '0'}`;
|
||||
// 优先使用已有的 syndromeGroupNo,避免每次保存生成新值导致重复创建
|
||||
const syndromeGroupNo = item.syndromeGroupNo || (
|
||||
item.conditionId
|
||||
? `${item.conditionId}-${item.tcmSyndromeCode || Date.now()}`
|
||||
: `${Date.now()}-${item.tcmSyndromeCode || '0'}`
|
||||
);
|
||||
// 使用原始疾病名称(illnessName),而非合并后的名称(如"感冒-风寒证")
|
||||
const illnessName = item.illnessName || item.name;
|
||||
await saveTcmDiagnosis({
|
||||
patientId: props.patientInfo.patientId,
|
||||
encounterId: props.patientInfo.encounterId,
|
||||
@@ -1010,7 +1031,7 @@ function handleSaveDiagnosis() {
|
||||
{
|
||||
conditionId: item.conditionId || null,
|
||||
encounterDiagnosisId: item.encounterDiagnosisId || null,
|
||||
name: item.name,
|
||||
name: illnessName,
|
||||
ybNo: item.ybNo,
|
||||
definitionId: item.definitionId || null,
|
||||
diagSrtNo: item.diagSrtNo,
|
||||
@@ -1162,5 +1183,14 @@ defineExpose({ getList, getDetail, handleSaveDiagnosis });
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.unsaved-diagnosis-tip {
|
||||
margin-bottom: 10px;
|
||||
color: #E6A23C;
|
||||
font-size: 13px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user