Merge branch 'develop' of https://gitea.gentronhealth.com/wangjunping/his into develop
This commit is contained in:
@@ -203,18 +203,32 @@ import { saveEmr, getEmrDetail, saveEmrTemplate } from '../api';
|
|||||||
import emrTemplate from '../emr/emrtemplate.vue';
|
import emrTemplate from '../emr/emrtemplate.vue';
|
||||||
import emrhistory from '../emr/emrhistory.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. 当前就诊日期(默认为当前时间)
|
// 2. 当前就诊日期(默认为当前时间;复诊为初诊日期)
|
||||||
const currentVisitDate = computed(() => {
|
const props = defineProps({
|
||||||
return new Date().toLocaleString('zh-CN', {
|
patientInfo: {
|
||||||
year: 'numeric',
|
type: Object,
|
||||||
month: '2-digit',
|
required: true,
|
||||||
day: '2-digit',
|
},
|
||||||
hour: '2-digit',
|
visitType: { // 接收父组件传来的值
|
||||||
minute: '2-digit',
|
type: String,
|
||||||
second: '2-digit',
|
default: '',
|
||||||
|
},
|
||||||
|
firstVisitDate: { // 父组件计算的初诊日期(若有历史病历)
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const currentVisitDate = computed(() => {
|
||||||
|
// 复诊优先展示初诊日期
|
||||||
|
if (props.visitType === 'FOLLOW_UP' && props.firstVisitDate) {
|
||||||
|
return props.firstVisitDate;
|
||||||
|
}
|
||||||
|
// 初诊或未获取初诊日期时,展示挂号时间或当前时间
|
||||||
|
return formatDate(props.patientInfo?.registerTime || new Date());
|
||||||
});
|
});
|
||||||
|
|
||||||
const form = ref({});
|
const form = ref({});
|
||||||
@@ -228,16 +242,6 @@ const { proxy } = getCurrentInstance();
|
|||||||
const showDialog = ref('');
|
const showDialog = ref('');
|
||||||
const openEmrTemplate = ref(false);
|
const openEmrTemplate = ref(false);
|
||||||
const templateName = ref('');
|
const templateName = ref('');
|
||||||
const props = defineProps({
|
|
||||||
patientInfo: {
|
|
||||||
type: Object,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
visitType: { // ✅ 接收父组件传来的值
|
|
||||||
type: String,
|
|
||||||
default: '',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => form.value,
|
() => form.value,
|
||||||
|
|||||||
@@ -148,6 +148,7 @@
|
|||||||
}
|
}
|
||||||
"
|
"
|
||||||
:visitType="visitType"
|
:visitType="visitType"
|
||||||
|
:firstVisitDate="firstVisitDate"
|
||||||
/>
|
/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="诊断" name="diagnosis">
|
<el-tab-pane label="诊断" name="diagnosis">
|
||||||
@@ -266,6 +267,7 @@ const waitCount = ref(0);
|
|||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const visitType = ref('');
|
const visitType = ref('');
|
||||||
|
const firstVisitDate = ref('');
|
||||||
const disabled = computed(() => {
|
const disabled = computed(() => {
|
||||||
return Object.keys(patientInfo.value).length === 0;
|
return Object.keys(patientInfo.value).length === 0;
|
||||||
});
|
});
|
||||||
@@ -294,6 +296,7 @@ function setVisitType(type) {
|
|||||||
function checkPatientHistory(patient) {
|
function checkPatientHistory(patient) {
|
||||||
// 重置状态
|
// 重置状态
|
||||||
visitTypeDisabled.value = false;
|
visitTypeDisabled.value = false;
|
||||||
|
firstVisitDate.value = '';
|
||||||
|
|
||||||
// 如果患者没有身份证号,无法判断是否为初诊
|
// 如果患者没有身份证号,无法判断是否为初诊
|
||||||
if (!patient.idCard) {
|
if (!patient.idCard) {
|
||||||
@@ -320,20 +323,31 @@ function checkPatientHistory(patient) {
|
|||||||
|
|
||||||
getEmrHistoryList(params).then(res => {
|
getEmrHistoryList(params).then(res => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
|
const records = res.data?.records || [];
|
||||||
// 如果有历史记录,则为复诊
|
// 如果有历史记录,则为复诊
|
||||||
if (res.data && res.data.total > 0) {
|
if (res.data && res.data.total > 0) {
|
||||||
visitType.value = 'FOLLOW_UP';
|
visitType.value = 'FOLLOW_UP';
|
||||||
|
// 计算最早一次病历创建时间作为初诊日期
|
||||||
|
const earliest = records.reduce((min, cur) => {
|
||||||
|
const ct = new Date(cur.createTime).getTime();
|
||||||
|
return ct < min ? ct : min;
|
||||||
|
}, new Date(records[0].createTime).getTime());
|
||||||
|
// 使用统一格式化
|
||||||
|
firstVisitDate.value = formatDate(earliest);
|
||||||
} else {
|
} else {
|
||||||
// 如果没有历史记录,则为初诊
|
// 如果没有历史记录,则为初诊
|
||||||
visitType.value = 'FIRST';
|
visitType.value = 'FIRST';
|
||||||
|
firstVisitDate.value = '';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 请求失败,默认设置为初诊
|
// 请求失败,默认设置为初诊
|
||||||
visitType.value = 'FIRST';
|
visitType.value = 'FIRST';
|
||||||
|
firstVisitDate.value = '';
|
||||||
}
|
}
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
// 异常情况,默认设置为初诊
|
// 异常情况,默认设置为初诊
|
||||||
visitType.value = 'FIRST';
|
visitType.value = 'FIRST';
|
||||||
|
firstVisitDate.value = '';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function getWaitPatient() {
|
function getWaitPatient() {
|
||||||
|
|||||||
Reference in New Issue
Block a user