@@ -1,232 +0,0 @@
|
||||
<template>
|
||||
<el-row :gutter="20" style="margin-bottom: 10px; display: flex; justify-content: flex-end">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" size="small" @click="enhancedHandleAddDiagnosis">
|
||||
新增诊断
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
size="small"
|
||||
@click="enhancedHandleDeleteDiagnosis"
|
||||
:disabled="multiple"
|
||||
>
|
||||
删除诊断
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="10">
|
||||
<el-table
|
||||
style="width: 100%; overflow-x: auto"
|
||||
:data="tableData"
|
||||
height="45vh"
|
||||
border
|
||||
ref="diagnosisTableRef"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="诊断名称" align="center" prop="diagName" width="180">
|
||||
<template #default="scope">
|
||||
<div style="margin-top: -5px; margin-bottom: -5px">
|
||||
<el-popover
|
||||
:popper-style="{ padding: '0' }"
|
||||
placement="bottom-start"
|
||||
:visible="scope.row.showPopover"
|
||||
trigger="manual"
|
||||
:width="800"
|
||||
>
|
||||
<diagnosislist
|
||||
:diagnosisSearchkey="diagnosisSearchkey"
|
||||
@selectDiagnosis="enhancedHandleSelsectDiagnosis"
|
||||
/>
|
||||
<template #reference>
|
||||
<el-input
|
||||
v-model="scope.row.diagName"
|
||||
placeholder="请选择诊断"
|
||||
@input="handleChange"
|
||||
@focus="handleFocus(scope.row, scope.$index)"
|
||||
@blur="handleBlur(scope.row)"
|
||||
:validate-event="false"
|
||||
/>
|
||||
</template>
|
||||
</el-popover>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="诊断编码" prop="diagCode" align="center" width="130">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.diagCode" disabled />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="诊断类型" prop="diagType" align="center" width="100">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.diagType" disabled />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否主诊断" align="center" prop="maindiagFlag" width="100">
|
||||
<template #default="scope">
|
||||
<el-checkbox
|
||||
label="主诊断"
|
||||
:trueLabel="1"
|
||||
:falseLabel="0"
|
||||
v-model="scope.row.maindiagFlag"
|
||||
border
|
||||
size="small"
|
||||
@change="(value) => handleMaindise(value, scope.$index)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="确诊时间" prop="diagTime" align="center" width="130">
|
||||
<template #default="scope">
|
||||
<el-date-picker v-model="scope.row.diagTime" type="date" placeholder="选择日期" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="说明" prop="diagDesc" align="center" width="130">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.diagDesc" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-row>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import diagnosislist from '../../../../doctorstation/components/diagnosis/diagnosislist.vue';
|
||||
|
||||
const props = defineProps({
|
||||
tableData: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
tableType: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
multiple: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
});
|
||||
watch(
|
||||
() => props.tableData,
|
||||
(newValue) => {
|
||||
if (newValue.length > 0) {
|
||||
setTableData(newValue);
|
||||
} else {
|
||||
setTableData([]);
|
||||
}
|
||||
}
|
||||
);
|
||||
const tableData = ref([]);
|
||||
const diagnosisTableRef = ref(null);
|
||||
const selectedRows = ref([]);
|
||||
const submitTableData = tableData;
|
||||
const setTableData = (data) => {
|
||||
tableData.value = data;
|
||||
};
|
||||
const handleAddDiagnosis = () => {
|
||||
tableData.value.push({
|
||||
diagName: '',
|
||||
diagCode: '',
|
||||
diagType: '',
|
||||
maindiagFlag: '',
|
||||
diagTime: '',
|
||||
diagDesc: '',
|
||||
showPopover: false,
|
||||
diseinfo: null,
|
||||
});
|
||||
};
|
||||
const handleDeleteDiagnosis = () => {
|
||||
if (selectedRows.value.length === 0) {
|
||||
return;
|
||||
}
|
||||
// 将选中的行从表格数据中移除
|
||||
tableData.value = tableData.value.filter((item) => !selectedRows.value.includes(item));
|
||||
// 清空选中状态
|
||||
selectedRows.value = [];
|
||||
if (diagnosisTableRef.value) {
|
||||
diagnosisTableRef.value.clearSelection();
|
||||
}
|
||||
};
|
||||
const multiple = ref(true);
|
||||
const diagnosisSearchkey = ref('');
|
||||
const currentRow = ref(null);
|
||||
const currentIndex = ref(-1);
|
||||
|
||||
const handleSelectionChange = (selection) => {
|
||||
selectedRows.value = selection;
|
||||
multiple.value = selection.length === 0;
|
||||
emit('selection-change', selection);
|
||||
};
|
||||
|
||||
const handleChange = (value) => {
|
||||
diagnosisSearchkey.value = value;
|
||||
};
|
||||
|
||||
const handleFocus = (row, index) => {
|
||||
currentRow.value = row;
|
||||
currentIndex.value = index;
|
||||
row.showPopover = true;
|
||||
};
|
||||
|
||||
const handleBlur = (row) => {
|
||||
setTimeout(() => {
|
||||
row.showPopover = false;
|
||||
}, 200);
|
||||
};
|
||||
|
||||
const handleSelsectDiagnosis = (row) => {
|
||||
// 入院诊断使用diseinfo数据源
|
||||
currentRow.value.diagName = row.diseinfo?.name || row.name;
|
||||
currentRow.value.diagCode = row.diseinfo?.ybNo || row.ybNo;
|
||||
currentRow.value.diagType = row.diseinfo?.typeName || row.typeName || '';
|
||||
currentRow.value.showPopover = false;
|
||||
};
|
||||
|
||||
function handleMaindise(value, index) {
|
||||
if (value == 1) {
|
||||
// 先将其他所有记录的主诊断标志设为0,确保只有一个主诊断
|
||||
tableData.value.forEach((item, i) => {
|
||||
if (i !== index) {
|
||||
item.maindiagFlag = 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
// 触发数据更新事件,将当前表格数据传递给父组件
|
||||
emit('data-change', tableData.value);
|
||||
}
|
||||
|
||||
// 修改原始函数以触发数据更新事件
|
||||
const originalHandleAddDiagnosis = handleAddDiagnosis;
|
||||
const enhancedHandleAddDiagnosis = () => {
|
||||
originalHandleAddDiagnosis();
|
||||
emit('data-change', tableData.value);
|
||||
};
|
||||
|
||||
const originalHandleDeleteDiagnosis = handleDeleteDiagnosis;
|
||||
const enhancedHandleDeleteDiagnosis = () => {
|
||||
originalHandleDeleteDiagnosis();
|
||||
emit('data-change', tableData.value);
|
||||
};
|
||||
|
||||
const originalHandleSelsectDiagnosis = handleSelsectDiagnosis;
|
||||
const enhancedHandleSelsectDiagnosis = (row) => {
|
||||
originalHandleSelsectDiagnosis(row);
|
||||
emit('data-change', tableData.value);
|
||||
};
|
||||
|
||||
const emit = defineEmits(['selection-change', 'data-change']);
|
||||
|
||||
defineExpose({
|
||||
submitTableData,
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
.el-table .cell {
|
||||
padding: 0 8px !important;
|
||||
}
|
||||
</style>
|
||||
@@ -1,232 +0,0 @@
|
||||
<template>
|
||||
<el-row :gutter="20" style="margin-bottom: 10px; display: flex; justify-content: flex-end">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" size="small" @click="enhancedHandleAddDiagnosis">
|
||||
新增诊断
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
size="small"
|
||||
@click="enhancedHandleDeleteDiagnosis"
|
||||
:disabled="multiple"
|
||||
>
|
||||
删除诊断
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="10">
|
||||
<el-table
|
||||
style="width: 100%; overflow-x: auto"
|
||||
:data="tableData"
|
||||
height="45vh"
|
||||
border
|
||||
ref="diagnosisTableRef"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="诊断名称" align="center" prop="diagName" width="180">
|
||||
<template #default="scope">
|
||||
<div style="margin-top: -5px; margin-bottom: -5px">
|
||||
<el-popover
|
||||
:popper-style="{ padding: '0' }"
|
||||
placement="bottom-start"
|
||||
:visible="scope.row.showPopover"
|
||||
trigger="manual"
|
||||
:width="800"
|
||||
>
|
||||
<diagnosislist
|
||||
:diagnosisSearchkey="diagnosisSearchkey"
|
||||
@selectDiagnosis="enhancedHandleSelsectDiagnosis"
|
||||
/>
|
||||
<template #reference>
|
||||
<el-input
|
||||
v-model="scope.row.diagName"
|
||||
placeholder="请选择诊断"
|
||||
@input="handleChange"
|
||||
@focus="handleFocus(scope.row, scope.$index)"
|
||||
@blur="handleBlur(scope.row)"
|
||||
:validate-event="false"
|
||||
/>
|
||||
</template>
|
||||
</el-popover>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="诊断编码" prop="diagCode" align="center" width="130">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.diagCode" disabled />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="诊断类型" prop="diagType" align="center" width="100">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.diagType" disabled />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否主诊断" align="center" prop="maindiagFlag" width="100">
|
||||
<template #default="scope">
|
||||
<el-checkbox
|
||||
label="主诊断"
|
||||
:trueLabel="1"
|
||||
:falseLabel="0"
|
||||
v-model="scope.row.maindiagFlag"
|
||||
border
|
||||
size="small"
|
||||
@change="(value) => handleMaindise(value, scope.$index)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="确诊时间" prop="diagTime" align="center" width="130">
|
||||
<template #default="scope">
|
||||
<el-date-picker v-model="scope.row.diagTime" type="date" placeholder="选择日期" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="说明" prop="diagDesc" align="center" width="130">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.diagDesc" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-row>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import diagnosislist from '../../../../doctorstation/components/diagnosis/diagnosislist.vue';
|
||||
|
||||
const props = defineProps({
|
||||
tableData: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
tableType: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
multiple: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
});
|
||||
watch(
|
||||
() => props.tableData,
|
||||
(newValue) => {
|
||||
if (newValue.length > 0) {
|
||||
setTableData(newValue);
|
||||
} else {
|
||||
setTableData([]);
|
||||
}
|
||||
}
|
||||
);
|
||||
const tableData = ref([]);
|
||||
const diagnosisTableRef = ref(null);
|
||||
const selectedRows = ref([]);
|
||||
const submitTableData = tableData;
|
||||
const setTableData = (data) => {
|
||||
tableData.value = data;
|
||||
};
|
||||
const handleAddDiagnosis = () => {
|
||||
tableData.value.push({
|
||||
diagName: '',
|
||||
diagCode: '',
|
||||
diagType: '',
|
||||
maindiagFlag: '',
|
||||
diagTime: '',
|
||||
diagDesc: '',
|
||||
showPopover: false,
|
||||
outDiseinfo: null,
|
||||
});
|
||||
};
|
||||
const handleDeleteDiagnosis = () => {
|
||||
if (selectedRows.value.length === 0) {
|
||||
return;
|
||||
}
|
||||
// 将选中的行从表格数据中移除
|
||||
tableData.value = tableData.value.filter((item) => !selectedRows.value.includes(item));
|
||||
// 清空选中状态
|
||||
selectedRows.value = [];
|
||||
if (diagnosisTableRef.value) {
|
||||
diagnosisTableRef.value.clearSelection();
|
||||
}
|
||||
};
|
||||
const multiple = ref(true);
|
||||
const diagnosisSearchkey = ref('');
|
||||
const currentRow = ref(null);
|
||||
const currentIndex = ref(-1);
|
||||
|
||||
const handleSelectionChange = (selection) => {
|
||||
selectedRows.value = selection;
|
||||
multiple.value = selection.length === 0;
|
||||
emit('selection-change', selection);
|
||||
};
|
||||
|
||||
const handleChange = (value) => {
|
||||
diagnosisSearchkey.value = value;
|
||||
};
|
||||
|
||||
const handleFocus = (row, index) => {
|
||||
currentRow.value = row;
|
||||
currentIndex.value = index;
|
||||
row.showPopover = true;
|
||||
};
|
||||
|
||||
const handleBlur = (row) => {
|
||||
setTimeout(() => {
|
||||
row.showPopover = false;
|
||||
}, 200);
|
||||
};
|
||||
|
||||
const handleSelsectDiagnosis = (row) => {
|
||||
// 出院诊断使用outDiseinfo数据源
|
||||
currentRow.value.diagName = row.outDiseinfo?.name || row.name;
|
||||
currentRow.value.diagCode = row.outDiseinfo?.ybNo || row.ybNo;
|
||||
currentRow.value.diagType = row.outDiseinfo?.typeName || row.typeName || '';
|
||||
currentRow.value.showPopover = false;
|
||||
};
|
||||
|
||||
function handleMaindise(value, index) {
|
||||
if (value == 1) {
|
||||
// 先将其他所有记录的主诊断标志设为0,确保只有一个主诊断
|
||||
tableData.value.forEach((item, i) => {
|
||||
if (i !== index) {
|
||||
item.maindiagFlag = 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
// 触发数据更新事件,将当前表格数据传递给父组件
|
||||
emit('data-change', tableData.value);
|
||||
}
|
||||
|
||||
// 修改原始函数以触发数据更新事件
|
||||
const originalHandleAddDiagnosis = handleAddDiagnosis;
|
||||
const enhancedHandleAddDiagnosis = () => {
|
||||
originalHandleAddDiagnosis();
|
||||
emit('data-change', tableData.value);
|
||||
};
|
||||
|
||||
const originalHandleDeleteDiagnosis = handleDeleteDiagnosis;
|
||||
const enhancedHandleDeleteDiagnosis = () => {
|
||||
originalHandleDeleteDiagnosis();
|
||||
emit('data-change', tableData.value);
|
||||
};
|
||||
|
||||
const originalHandleSelsectDiagnosis = handleSelsectDiagnosis;
|
||||
const enhancedHandleSelsectDiagnosis = (row) => {
|
||||
originalHandleSelsectDiagnosis(row);
|
||||
emit('data-change', tableData.value);
|
||||
};
|
||||
|
||||
const emit = defineEmits(['selection-change', 'data-change']);
|
||||
|
||||
defineExpose({
|
||||
submitTableData,
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
.el-table .cell {
|
||||
padding: 0 8px !important;
|
||||
}
|
||||
</style>
|
||||
@@ -1,537 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container" v-loading="loading" loading-text="保存中。。。">
|
||||
<!-- 操作框 -->
|
||||
<el-row justify="end" :gutter="20">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" @click="handleSave">保存</el-button>
|
||||
<el-button @click="handleCancel">取消</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- 读卡功能区域 -->
|
||||
<div class="read-card-section">
|
||||
<el-radio-group v-model="typeCode">
|
||||
<el-button type="primary" plain @click="handleReadCard('01')" style="width: 65px">
|
||||
电子凭证
|
||||
</el-button>
|
||||
<el-button type="primary" plain @click="handleReadCard('02')" style="width: 65px">
|
||||
身份证
|
||||
</el-button>
|
||||
<el-button type="primary" plain @click="handleReadCard('03')" style="width: 65px">
|
||||
医保卡
|
||||
</el-button>
|
||||
</el-radio-group>
|
||||
<el-button type="primary" @click="handleReadCard(typeCode)" :loading="readCardLoading">
|
||||
{{ loadingText }}
|
||||
</el-button>
|
||||
</div>
|
||||
<el-divider></el-divider>
|
||||
<RegisterForm ref="registerFormRef" :registerForm="registerForm" />
|
||||
<el-divider></el-divider>
|
||||
<el-row :gutter="80">
|
||||
<el-col :span="12">
|
||||
<h3 style="margin-bottom: 0px">入院诊断</h3>
|
||||
<AdmissionDiagnosis :tableData="inHospitalDiagnosisTableData" @data-change="handleInHospitalDiagnosisChange" />
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<h3 style="margin-bottom: 0px">出院诊断</h3>
|
||||
<DischargeDiagnosis :tableData="historyDiagnosisTableData" ref="historyDiagnosisTableDataRef"
|
||||
@data-change="handleHistoryDiagnosisChange" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { computed, onMounted, reactive, ref, getCurrentInstance } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import AdmissionDiagnosis from './AdmissionDiagnosis.vue';
|
||||
import DischargeDiagnosis from './DischargeDiagnosis.vue';
|
||||
import RegisterForm from './registerForm.vue';
|
||||
import {
|
||||
getInHospitalInfo,
|
||||
getInpatientCheckInfo,
|
||||
getInpatientRegInfo,
|
||||
saveEmr,
|
||||
checkOutInpatient,
|
||||
updateInpatientRegInfo,
|
||||
gerPreInfo,
|
||||
} from './api';
|
||||
import { invokeYbPlugin5001 } from '@/api/public';
|
||||
import useTagsViewStore from '@/store/modules/tagsView';
|
||||
import useUserStore from '@/store/modules/user';
|
||||
const { proxy } = getCurrentInstance();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const tagsViewStore = useTagsViewStore();
|
||||
const encounterId = ref('')
|
||||
// const certType = computed(() => route.query.certType);
|
||||
const operationType = computed(() => route.query.operationType || 'register'); // 默认是医保登记
|
||||
const mdtrtId = computed(() => route.query.mdtrtId);
|
||||
const queryRef = ref(null);
|
||||
|
||||
const registerFormRef = ref(null);
|
||||
const inHospitalDiagnosisTableData = ref([]);
|
||||
const inHospitalDiagnosisTableDataRef = ref(null);
|
||||
const historyDiagnosisTableData = ref([]);
|
||||
const historyDiagnosisTableRef = ref(null);
|
||||
const loading = ref(false);
|
||||
const registerForm = ref({});
|
||||
const userStore = useUserStore();
|
||||
const typeCode = ref('01');
|
||||
const readCardLoading = ref(false);
|
||||
const loadingText = ref('读卡');
|
||||
let userCardInfo = ref({});
|
||||
const BusiCardInfo = ref('');
|
||||
const form = reactive({});
|
||||
|
||||
// 处理入院诊断数据变更
|
||||
const handleInHospitalDiagnosisChange = (data) => {
|
||||
inHospitalDiagnosisTableData.value = data;
|
||||
console.log('入院诊断数据已更新:', data);
|
||||
};
|
||||
|
||||
// 处理出院诊断数据变更
|
||||
const handleHistoryDiagnosisChange = (data) => {
|
||||
historyDiagnosisTableData.value = data;
|
||||
console.log('出院诊断数据已更新:', data);
|
||||
};
|
||||
|
||||
const loadRegisterInfo = async () => {
|
||||
loading.value = true;
|
||||
try {
|
||||
let res;
|
||||
|
||||
// 根据操作类型调用不同的接口
|
||||
switch (operationType.value) {
|
||||
case 'register':
|
||||
// 医保登记 - 使用 getInHospitalInfo 接口
|
||||
if (!encounterId.value) {
|
||||
proxy.$message.error('缺少就诊标识');
|
||||
return;
|
||||
}
|
||||
res = await getInHospitalInfo(encounterId.value);
|
||||
break;
|
||||
|
||||
case 'discharge':
|
||||
// 医保出院 - 使用 getInpatientCheckInfo 接口
|
||||
if (!mdtrtId.value) {
|
||||
proxy.$message.error('缺少医保就诊ID');
|
||||
return;
|
||||
}
|
||||
res = await getInpatientCheckInfo({ mdtrtId: mdtrtId.value });
|
||||
break;
|
||||
|
||||
case 'change':
|
||||
// 信息变更 - 使用 getInpatientRegInfo 接口
|
||||
if (!mdtrtId.value) {
|
||||
proxy.$message.error('缺少医保就诊ID');
|
||||
return;
|
||||
}
|
||||
res = await getInpatientRegInfo({ mdtrtId: mdtrtId.value });
|
||||
break;
|
||||
|
||||
default:
|
||||
ElMessage.error('无效的操作类型');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`获取${operationType.value}信息`, res);
|
||||
|
||||
if (res.code !== 200) {
|
||||
ElMessage.error(res.message || `获取${operationType.value}信息失败`);
|
||||
return;
|
||||
}
|
||||
const data = res.data || {};
|
||||
registerForm.value = data.mdtrtinfo || {};
|
||||
// 入院诊断从diseinfo获取
|
||||
inHospitalDiagnosisTableData.value = (data.diseinfo || []).map((item) => ({
|
||||
id: item.id,
|
||||
diagName: item.diagName || item.name || '',
|
||||
diagCode: item.diagCode,
|
||||
diagType: item.diagType,
|
||||
maindiagFlag: item.maindiagFlag,
|
||||
diagTime: item.diagTime,
|
||||
diagDesc: item.diagDesc,
|
||||
showPopover: false, // 添加弹出框控制标志
|
||||
}));
|
||||
// 出院诊断从outDiseinfo获取
|
||||
historyDiagnosisTableData.value = (data.outDiseinfo || []).map((item) => ({
|
||||
id: item.id,
|
||||
diagName: item.diagName || item.name || '',
|
||||
diagCode: item.diagCode,
|
||||
diagType: item.diagType,
|
||||
maindiagFlag: item.maindiagFlag,
|
||||
diagTime: item.diagTime,
|
||||
diagDesc: item.diagDesc,
|
||||
showPopover: false, // 添加弹出框控制标志
|
||||
}));
|
||||
} catch (error) {
|
||||
console.error('加载登记信息失败:', error);
|
||||
setTimeout(() => {
|
||||
handleCancel();
|
||||
}, 2000);
|
||||
return;
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const handleSave = async () => {
|
||||
console.log('registerFormRef.value', registerFormRef.value);
|
||||
if (!registerFormRef.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 使用async/await获取表单验证结果
|
||||
const valid = await registerFormRef.value.validateData();
|
||||
console.log('valid', valid);
|
||||
|
||||
if (valid) {
|
||||
loading.value = true;
|
||||
try {
|
||||
// 构建请求参数,按照要求的格式组织数据
|
||||
const payload = {
|
||||
// 基本信息存到 mdtrtinfo
|
||||
mdtrtinfo: {
|
||||
...registerFormRef.value.submitForm,
|
||||
encounterId: encounterId.value,
|
||||
mdtrtId: mdtrtId.value,
|
||||
// certType:certType.value,
|
||||
},
|
||||
// 入院诊断信息存到 diseinfo
|
||||
diseinfo: (inHospitalDiagnosisTableDataRef.value?.submitTableData || []).map(
|
||||
(item, index) => ({
|
||||
// 转换诊断数据格式以匹配后端要求
|
||||
diagName: item.diagName || item.name,
|
||||
diagCode: item.diagCode,
|
||||
diagType: item.diagType,
|
||||
maindiagFlag: item.maindiagFlag || '0',
|
||||
diagTime: item.diagTime,
|
||||
diagSrtNo: index + 1,
|
||||
diagDesc: item.diagDesc,
|
||||
})
|
||||
),
|
||||
// 出院诊断信息存到 outDiseinfo
|
||||
outDiseinfo: (historyDiagnosisTableRef.value?.submitTableData || []).map((item, index) => ({
|
||||
// 转换诊断数据格式以匹配后端要求
|
||||
diagName: item.diagName || item.name,
|
||||
diagCode: item.diagCode,
|
||||
diagType: item.diagType,
|
||||
maindiagFlag: item.maindiagFlag || '0',
|
||||
diagTime: item.diagTime,
|
||||
diagSrtNo: index + 1,
|
||||
diagDesc: item.diagDesc,
|
||||
})),
|
||||
};
|
||||
|
||||
let res;
|
||||
|
||||
// 根据操作类型调用不同的保存接口
|
||||
switch (operationType.value) {
|
||||
case ('register', 'HospitalizationRegistration'):
|
||||
// 医保登记 - 使用 saveEmr 接口
|
||||
console.log('保存医保登记数据:', payload);
|
||||
res = await saveEmr(payload);
|
||||
break;
|
||||
|
||||
case 'discharge':
|
||||
// 医保出院 - 使用 checkOutInpatient 接口
|
||||
console.log('保存医保出院数据:', payload);
|
||||
res = await checkOutInpatient(payload);
|
||||
break;
|
||||
|
||||
case 'change':
|
||||
// 信息变更 - 使用 updateInpatientRegInfo 接口
|
||||
console.log('保存信息变更数据:', payload);
|
||||
res = await updateInpatientRegInfo(payload);
|
||||
break;
|
||||
}
|
||||
|
||||
if (res.code === 200) {
|
||||
const operationNames = {
|
||||
register: '医保登记',
|
||||
discharge: '医保出院',
|
||||
change: '信息变更',
|
||||
};
|
||||
ElMessage.success(`${operationNames[operationType.value]}保存成功`);
|
||||
handleCancel();
|
||||
} else {
|
||||
ElMessage.error(res.message || '保存失败');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('保存失败:', error);
|
||||
ElMessage.error('保存失败,请重试');
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
} else {
|
||||
ElMessage.warning('表单验证失败,请检查填写内容');
|
||||
}
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
const currentView = { ...router.currentRoute.value };
|
||||
router
|
||||
.push({
|
||||
path: '/ybmanagement/ybInhospital/ybInhospitalRegister',
|
||||
})
|
||||
.then(() => {
|
||||
tagsViewStore.delView(currentView);
|
||||
});
|
||||
};
|
||||
|
||||
// 医保信息变更
|
||||
const doYbChange = (row) => {
|
||||
// 跳转到编辑页面,并传递operationType参数标识这是信息变更操作
|
||||
router.push({
|
||||
name: 'YbregisterEdit',
|
||||
query: {
|
||||
encounterId: row.encounterId,
|
||||
operationType: 'change', // 添加操作类型参数,标识是信息变更
|
||||
mdtrtId: row.mdtrtId,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
// 处理接收到的卡片数据
|
||||
const processCardData = (cardData) => {
|
||||
if (!cardData) return;
|
||||
|
||||
try {
|
||||
console.log('开始处理卡片数据:', cardData);
|
||||
|
||||
// 处理患者基本信息
|
||||
if (cardData.patientInfo) {
|
||||
console.log('患者基本信息:', cardData.patientInfo);
|
||||
// 将患者信息映射到医保登记表单
|
||||
registerForm.value = {
|
||||
...registerForm.value,
|
||||
// 患者基本信息
|
||||
patientName: cardData.patientInfo.patientName || cardData.patientInfo.name || '',
|
||||
idCard: cardData.patientInfo.idCard || '',
|
||||
gender: cardData.patientInfo.gender || '',
|
||||
birthDate: cardData.patientInfo.birthDate || '',
|
||||
phone: cardData.patientInfo.phone || '',
|
||||
// 其他患者相关字段
|
||||
patientId: cardData.patientInfo.patientId || '',
|
||||
patCode: cardData.patientInfo.code || '',
|
||||
};
|
||||
}
|
||||
|
||||
// 处理住院信息
|
||||
if (cardData.inHospitalInfo) {
|
||||
console.log('住院信息:', cardData.inHospitalInfo);
|
||||
registerForm.value = {
|
||||
...registerForm.value,
|
||||
// 住院相关信息
|
||||
admissionDate:
|
||||
cardData.inHospitalInfo.startTime || cardData.inHospitalInfo.admissionDate || '',
|
||||
deptName: cardData.inHospitalInfo.departmentName || cardData.inHospitalInfo.deptName || '',
|
||||
wardName: cardData.inHospitalInfo.wardLocationId || cardData.inHospitalInfo.wardName || '',
|
||||
diagnosisName:
|
||||
cardData.inHospitalInfo.ambDiagnosisName || cardData.inHospitalInfo.diagnosisName || '',
|
||||
// 其他住院相关字段
|
||||
encounterId: cardData.inHospitalInfo.encounterId || '',
|
||||
visitNo: cardData.inHospitalInfo.visitNo || '',
|
||||
bedNo: cardData.inHospitalInfo.bedNo || '',
|
||||
admissionDeptName: cardData.inHospitalInfo.admissionDeptName || '',
|
||||
};
|
||||
}
|
||||
|
||||
console.log('处理后的表单数据:', registerForm.value);
|
||||
} catch (e) {
|
||||
console.error('处理卡片数据时出错:', e);
|
||||
}
|
||||
};
|
||||
|
||||
// 处理读卡功能
|
||||
async function handleReadCard(value) {
|
||||
try {
|
||||
let jsonResult;
|
||||
let cardInfo;
|
||||
let userMessage = undefined;
|
||||
// let certType;
|
||||
|
||||
console.log('encounterId:', registerForm.value.encounterId);
|
||||
// console.log('certType:',certType.value);
|
||||
// encounterId.value = registerForm.value.encounterId;
|
||||
|
||||
switch (value) {
|
||||
case '01': // 电子凭证
|
||||
await invokeYbPlugin5001({
|
||||
FunctionId: 3,
|
||||
url: 'http://10.47.0.67:8089/localcfc/api/hsecfc/localQrCodeQuery',
|
||||
orgId: 'H22010200672',
|
||||
businessType: '01101',
|
||||
operatorId: userStore.id.toString(),
|
||||
operatorName: userStore.name,
|
||||
officeId: 'D83',
|
||||
officeName: '财务科',
|
||||
// certType: certType.value,
|
||||
encounterId: registerForm.value.encounterId,
|
||||
})
|
||||
.then((res) => {
|
||||
readCardLoading.value = true;
|
||||
loadingText.value = '正在读取...';
|
||||
console.log(res);
|
||||
jsonResult = res.data;
|
||||
})
|
||||
.catch(() => {
|
||||
readCardLoading.value = false;
|
||||
});
|
||||
cardInfo = JSON.parse(JSON.stringify(jsonResult));
|
||||
let message = JSON.parse(cardInfo.message);
|
||||
const encounterIdValue = registerForm.value.encounterId;
|
||||
console.log('准备使用的encounterId:', registerForm.value.encounterId);
|
||||
|
||||
userMessage = {
|
||||
certType: '02', // 证件类型
|
||||
certNo: message.data.idNo, // 身份证号
|
||||
psnCertType: '02', // 居民身份证
|
||||
encounterId: encounterIdValue,
|
||||
};
|
||||
userCardInfo = {
|
||||
certType: '01', // 证件类型
|
||||
certNo: message.data.idNo, // 身份证号
|
||||
psnCertType: '01', // 居民身份证
|
||||
busiCardInfo: message.data.ecToken, // 令牌
|
||||
encounterId: encounterIdValue,
|
||||
};
|
||||
BusiCardInfo.value = message.data.ecToken;
|
||||
console.log(BusiCardInfo.value);
|
||||
break;
|
||||
case '02':
|
||||
break;
|
||||
case '03': // 社保卡
|
||||
|
||||
readCardLoading.value = true;
|
||||
loadingText.value = '正在读取...';
|
||||
await invokeYbPlugin5001(
|
||||
JSON.stringify({
|
||||
FunctionId: 1,
|
||||
IP: 'ddjk.jlhs.gov.cn',
|
||||
PORT: 20215,
|
||||
TIMEOUT: 60,
|
||||
SFZ_DRIVER_TYPE: 1,
|
||||
})
|
||||
)
|
||||
.then((res) => {
|
||||
jsonResult = JSON.stringify(res.data);
|
||||
})
|
||||
.finally(() => {
|
||||
readCardLoading.value = false;
|
||||
});
|
||||
|
||||
let message1 = JSON.parse(jsonResult);
|
||||
const encounterIdValue2 = registerForm.value.encounterId;
|
||||
|
||||
userMessage = {
|
||||
certType: '02', // 证件类型
|
||||
certNo: message1.SocialSecurityNumber, // 身份证号
|
||||
psnCertType: '02', // 居民身份证
|
||||
encounterId: encounterIdValue2,
|
||||
};
|
||||
userCardInfo = {
|
||||
certType: '02', // 证件类型
|
||||
certNo: message1.SocialSecurityNumber, // 身份证号
|
||||
psnCertType: '02', // 居民身份证
|
||||
busiCardInfo: message1.BusiCardInfo, //卡号
|
||||
encounterId: encounterIdValue2,
|
||||
};
|
||||
BusiCardInfo.value = message1.BusiCardInfo;
|
||||
console.log(message1.BusiCardInfo);
|
||||
break;
|
||||
case '99':
|
||||
break;
|
||||
}
|
||||
readCardLoading.value = true;
|
||||
console.log('发送给gerPreInfo的参数:', userMessage);
|
||||
|
||||
if (userMessage && userMessage.certNo) {
|
||||
// 这里可以根据需要调用获取患者信息的接口
|
||||
// 并将获取到的信息填充到registerForm中
|
||||
// 由于registerEdit.vue没有直接引入gerPreInfo,这里注释掉
|
||||
console.log('开始调用gerPreInfo...');
|
||||
gerPreInfo(userMessage)
|
||||
.then((res) => {
|
||||
console.log('gerPreInfo返回结果:', res);
|
||||
if (res && res.code == 200 && res.data) {
|
||||
// 将获取到的患者信息填充到registerForm
|
||||
processCardData({
|
||||
patientInfo: {
|
||||
patientName: res.data.name,
|
||||
idCard: res.data.idCard,
|
||||
patientId: res.data.id,
|
||||
code: res.data.id,
|
||||
gender: res.data.genderEnum,
|
||||
// 其他需要的字段
|
||||
encounterId:registerForm.value.encounterId,
|
||||
certType:userMessage.certType,
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ElMessage.error('未获取到有效的患者信息');
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('gerPreInfo调用失败:', error);
|
||||
})
|
||||
.finally(() => {
|
||||
readCardLoading.value = false;
|
||||
});
|
||||
|
||||
ElMessage.success('读卡成功');
|
||||
readCardLoading.value = false;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('调用失败:', error);
|
||||
ElMessage.error('读卡失败');
|
||||
readCardLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
console.log('路由参数:', route.query);
|
||||
console.log('操作类型:', operationType.value);
|
||||
|
||||
// 优先检查是否有卡片数据传递过来
|
||||
const cardDataParam = route.query.cardData || route.params.cardData;
|
||||
const cardType = route.query.cardType || route.params.cardType;
|
||||
|
||||
if (cardDataParam) {
|
||||
try {
|
||||
console.log('卡片数据参数存在:', cardDataParam);
|
||||
const cardData = JSON.parse(decodeURIComponent(cardDataParam));
|
||||
console.log('接收到的卡片数据:', cardData);
|
||||
console.log('卡片类型:', cardType);
|
||||
|
||||
// 处理接收到的数据
|
||||
processCardData(cardData);
|
||||
} catch (e) {
|
||||
console.error('解析卡片数据失败:', e);
|
||||
console.error('原始卡片数据:', cardDataParam);
|
||||
}
|
||||
} else {
|
||||
console.log('没有接收到卡片数据');
|
||||
}
|
||||
|
||||
// 对于HospitalizationRegistration操作类型,不调用loadRegisterInfo,因为数据已通过卡片传递
|
||||
if (operationType.value !== 'HospitalizationRegistration' && encounterId.value) {
|
||||
console.log('调用loadRegisterInfo加载信息');
|
||||
loadRegisterInfo();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.read-card-section {
|
||||
margin-bottom: 20px;
|
||||
padding: 15px;
|
||||
background: #f5f7fa;
|
||||
border-radius: 4px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user