This commit is contained in:
叶锦涛
2025-10-31 16:32:53 +08:00
2 changed files with 38 additions and 20 deletions

View File

@@ -203,18 +203,32 @@ import { saveEmr, getEmrDetail, saveEmrTemplate } from '../api';
import emrTemplate from '../emr/emrtemplate.vue';
import emrhistory from '../emr/emrhistory.vue';
import { ref, computed } from 'vue';
import { ref, computed, watch, getCurrentInstance } from 'vue';
import { formatDate } from '@/utils/index';
// 2. 当前就诊日期(默认为当前时间;复诊为初诊日期)
const props = defineProps({
patientInfo: {
type: Object,
required: true,
},
visitType: { // 接收父组件传来的值
type: String,
default: '',
},
firstVisitDate: { // 父组件计算的初诊日期(若有历史病历)
type: String,
default: '',
},
});
// 2. 当前就诊日期(默认为当前时间)
const currentVisitDate = computed(() => {
return new Date().toLocaleString('zh-CN', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
});
// 复诊优先展示初诊日期
if (props.visitType === 'FOLLOW_UP' && props.firstVisitDate) {
return props.firstVisitDate;
}
// 初诊或未获取初诊日期时,展示挂号时间或当前时间
return formatDate(props.patientInfo?.registerTime || new Date());
});
const form = ref({});
@@ -228,16 +242,6 @@ const { proxy } = getCurrentInstance();
const showDialog = ref('');
const openEmrTemplate = ref(false);
const templateName = ref('');
const props = defineProps({
patientInfo: {
type: Object,
required: true,
},
visitType: { // ✅ 接收父组件传来的值
type: String,
default: '',
},
});
watch(
() => form.value,