增加就诊和复诊的选定按钮和判断逻辑

This commit is contained in:
2025-10-23 16:01:34 +08:00
parent 51ee8d1b43
commit 388425084e
2 changed files with 73 additions and 32 deletions

View File

@@ -98,35 +98,36 @@
<el-descriptions-item label="医生:" width="150">{{
userStore.name
}}</el-descriptions-item>
<el-descriptions-item label="" width="300">
<el-button type="primary" plain @click.stop="handleFinish(patientInfo.encounterId)">
完诊
</el-button>
<el-button type="primary" plain @click.stop="handleLeave(patientInfo.encounterId)">
暂离
</el-button>
<el-button type="primary" plain @click.stop="handleRefund(patientInfo.encounterId)">
退费
</el-button>
<el-button
type="primary"
plain
@click.stop="getEnPrescription(patientInfo.encounterId)"
>
处方单
</el-button>
<el-button
type="primary"
plain
@click.stop="
() => {
openDialog = true;
}
"
>
办理住院
</el-button>
</el-descriptions-item>
<el-descriptions-item label="" width="350">
<!-- 初诊 / 复诊 按钮 -->
<el-radio v-model="visitType" label="FIRST">初诊</el-radio>
<el-radio v-model="visitType" label="FOLLOW_UP">复诊</el-radio>
<!-- 原有按钮 -->
<el-button type="primary" plain @click.stop="handleFinish(patientInfo.encounterId)">
完诊
</el-button>
<el-button type="primary" plain @click.stop="handleLeave(patientInfo.encounterId)">
暂离
</el-button>
<el-button type="primary" plain @click.stop="handleRefund(patientInfo.encounterId)">
退费
</el-button>
<el-button
type="primary"
plain
@click.stop="getEnPrescription(patientInfo.encounterId)"
>
处方单
</el-button>
<el-button
type="primary"
plain
@click.stop="openDialog = true"
>
办理住院
</el-button>
</el-descriptions-item>
</el-descriptions>
</div>
<div style="padding: 10px">
@@ -204,6 +205,7 @@ import {
leaveEncounter,
completeEncounter,
getEnPrescriptionInfo,
getEmrHistoryList
} from './components/api.js';
import prescriptionlist from './components/prescription/prescriptionlist.vue';
import RefundListDialog from './components/prescription/refundListDialog.vue';
@@ -260,6 +262,7 @@ const diagnosisRef = ref();
const waitCount = ref(0);
const loading = ref(false);
const { proxy } = getCurrentInstance();
const visitType = ref('');
const disabled = computed(() => {
return Object.keys(patientInfo.value).length === 0;
});
@@ -282,7 +285,41 @@ function getPatientList() {
});
});
}
function setVisitType(type) {
visitType.value = type;
}
function checkPatientHistory(patient) {
// 如果患者没有身份证号,无法判断是否为初诊
if (!patient.idCard) {
// 默认设置为初诊
visitType.value = 'FIRST';
return;
}
// 查询患者历史就诊记录
const params = {
patientId: patient.patientId,
idCard: patient.idCard
};
getEmrHistoryList(params).then(res => {
if (res.code === 200) {
// 如果有历史记录,则为复诊
if (res.data && res.data.total > 0) {
visitType.value = 'FOLLOW_UP';
} else {
// 如果没有历史记录,则为初诊
visitType.value = 'FIRST';
}
} else {
// 请求失败,默认设置为初诊
visitType.value = 'FIRST';
}
}).catch(() => {
// 异常情况,默认设置为初诊
visitType.value = 'FIRST';
});
}
function getWaitPatient() {
queryParams.value.registerTimeSTime = formatDateStr(new Date(), 'YYYY-MM-DD') + ' 00:00:00';
queryParams.value.registerTimeETime = formatDateStr(new Date(), 'YYYY-MM-DD') + ' 23:59:59';
@@ -341,7 +378,7 @@ function handleOpen() {
}
function handleCardClick(item, index) {
currentEncounterId.value = '';
currentEncounterId.value = '';
// if (item.active) {
// patientList.value[index].active = false;
// return;
@@ -351,6 +388,10 @@ function handleCardClick(item, index) {
patient.active = patient.encounterId === item.encounterId;
});
patientInfo.value = item;
// 检查患者历史记录以确定初诊/复诊
checkPatientHistory(item);
activeTab.value = 'emr';
nextTick(() => {
prescriptionRef.value.getListInfo();