完成:102 门诊医生站-》诊断TAB页:增加报卡弹框登记界面
疾病报告卡新增功能。 修改诊断疾病的sql查询语句
This commit is contained in:
@@ -64,7 +64,7 @@
|
||||
<el-col :span="20" :xs="24">
|
||||
<div style="margin-bottom: 10px">
|
||||
<el-button type="primary" plain @click="handleAddDiagnosis()"> 新增诊断 </el-button>
|
||||
<el-button type="primary" plain @click="handleSaveDiagnosis()"> 保存诊断 </el-button>
|
||||
<el-button type="primary" plain @click="handleSaveDiagnosis()" :loading="saveLoading"> 保存诊断 </el-button>
|
||||
<el-button type="primary" plain @click="handleAddTcmDiagonsis()"> 中医诊断 </el-button>
|
||||
<el-button type="primary" plain @click="handleImport()"> 导入慢性病诊断 </el-button>
|
||||
<span style="font-size: 12px; margin-left: 10px"
|
||||
@@ -279,6 +279,7 @@ const diagnosisOptions = ref([]);
|
||||
const rowIndex = ref();
|
||||
const diagnosis = ref();
|
||||
const orgOrUser = ref();
|
||||
const saveLoading = ref(false);
|
||||
const form = ref({
|
||||
diagnosisList: [],
|
||||
isDataLoaded: false,
|
||||
@@ -325,52 +326,52 @@ function refreshData() {
|
||||
getList();
|
||||
}
|
||||
let maxNo = 99;
|
||||
function getList() {
|
||||
getEncounterDiagnosis(props.patientInfo.encounterId)
|
||||
.then((res) => {
|
||||
if (res.code == 200) {
|
||||
// 过滤掉中医诊断,只保留西医诊断
|
||||
form.value.diagnosisList = res.data.filter(item => item.typeName !== '中医诊断');
|
||||
// 为旧数据添加默认分类
|
||||
form.value.diagnosisList.forEach(item => {
|
||||
if (!item.classification) {
|
||||
item.classification = '西医';
|
||||
}
|
||||
});
|
||||
emits('diagnosisSave', false);
|
||||
}
|
||||
maxNo = form.value.diagnosisList.length;
|
||||
})
|
||||
.then(() => {
|
||||
getTcmDiagnosis({ encounterId: props.patientInfo.encounterId }).then((res) => {
|
||||
if (res.code == 200) {
|
||||
if (res.data.illness.length > 0) {
|
||||
res.data.illness.forEach((item, index) => {
|
||||
if (item.diagSrtNo <= maxNo) {
|
||||
return;
|
||||
}
|
||||
form.value.diagnosisList.push({
|
||||
name: item.name + '-' + res.data.symptom[index].name,
|
||||
diagSrtNo: item.diagSrtNo,
|
||||
ybNo: item.ybNo,
|
||||
medTypeCode: item.medTypeCode,
|
||||
syndromeGroupNo: item.syndromeGroupNo,
|
||||
typeName: '中医诊断',
|
||||
classification: '中医', // 中医诊断默认分类
|
||||
onsetDate: item.onsetDate,
|
||||
updateId:item.encounterDiagnosisId+'-'+res.data.symptom[index].encounterDiagnosisId,
|
||||
illnessDefinitionId : item.definitionId,
|
||||
symptomDefinitionId : res.data.symptom[index].definitionId,
|
||||
symptomYbNo: res.data.symptom[index].ybNo,
|
||||
});
|
||||
maxNo = item.diagSrtNo;
|
||||
});
|
||||
}
|
||||
emits('diagnosisSave', false);
|
||||
async function getList() {
|
||||
try {
|
||||
const res = await getEncounterDiagnosis(props.patientInfo.encounterId);
|
||||
if (res.code == 200) {
|
||||
// 过滤掉中医诊断,只保留西医诊断
|
||||
form.value.diagnosisList = res.data.filter(item => item.typeName !== '中医诊断');
|
||||
// 为旧数据添加默认分类
|
||||
form.value.diagnosisList.forEach(item => {
|
||||
if (!item.classification) {
|
||||
item.classification = '西医';
|
||||
}
|
||||
});
|
||||
});
|
||||
getTree();
|
||||
emits('diagnosisSave', false);
|
||||
}
|
||||
maxNo = form.value.diagnosisList.length;
|
||||
|
||||
const tcmRes = await getTcmDiagnosis({ encounterId: props.patientInfo.encounterId });
|
||||
if (tcmRes.code == 200) {
|
||||
if (tcmRes.data.illness.length > 0) {
|
||||
tcmRes.data.illness.forEach((item, index) => {
|
||||
if (item.diagSrtNo <= maxNo) {
|
||||
return;
|
||||
}
|
||||
form.value.diagnosisList.push({
|
||||
name: item.name + '-' + tcmRes.data.symptom[index].name,
|
||||
diagSrtNo: item.diagSrtNo,
|
||||
ybNo: item.ybNo,
|
||||
medTypeCode: item.medTypeCode,
|
||||
syndromeGroupNo: item.syndromeGroupNo,
|
||||
typeName: '中医诊断',
|
||||
classification: '中医', // 中医诊断默认分类
|
||||
onsetDate: item.onsetDate,
|
||||
updateId:item.encounterDiagnosisId+'-'+tcmRes.data.symptom[index].encounterDiagnosisId,
|
||||
illnessDefinitionId : item.definitionId,
|
||||
symptomDefinitionId : tcmRes.data.symptom[index].definitionId,
|
||||
symptomYbNo: tcmRes.data.symptom[index].ybNo,
|
||||
});
|
||||
maxNo = item.diagSrtNo;
|
||||
});
|
||||
}
|
||||
emits('diagnosisSave', false);
|
||||
}
|
||||
getTree();
|
||||
} catch (error) {
|
||||
console.error('获取诊断列表失败:', error);
|
||||
}
|
||||
}
|
||||
|
||||
init();
|
||||
@@ -574,54 +575,105 @@ function handleMaindise(value, index) {
|
||||
|
||||
/**
|
||||
* 保存诊断
|
||||
* 使用 async/await 重构,优化错误处理和加载状态
|
||||
*/
|
||||
function handleSaveDiagnosis() {
|
||||
proxy.$refs.formRef.validate((valid) => {
|
||||
if (valid) {
|
||||
if (form.value.diagnosisList.length == 0) {
|
||||
proxy.$modal.msgWarning('诊断不能为空');
|
||||
return false;
|
||||
} else if (!form.value.diagnosisList.some((diagnosis) => diagnosis.maindiseFlag === 1)) {
|
||||
proxy.$modal.msgWarning('至少添加一条主诊断');
|
||||
return false;
|
||||
} else {
|
||||
// 保存前按排序号排序
|
||||
form.value.diagnosisList.sort((a, b) => (a.diagSrtNo || 0) - (b.diagSrtNo || 0));
|
||||
|
||||
saveDiagnosis({
|
||||
patientId: props.patientInfo.patientId,
|
||||
encounterId: props.patientInfo.encounterId,
|
||||
diagnosisChildList: form.value.diagnosisList,
|
||||
}).then((res) => {
|
||||
if (res.code == 200) {
|
||||
getTree();
|
||||
getList();
|
||||
emits('diagnosisSave', false);
|
||||
proxy.$modal.msgSuccess('诊断已保存并按排序号排序');
|
||||
//食源性疾病病例数据智能采集 ---START---
|
||||
isFoodDiseasesNew({
|
||||
encounterId: props.patientInfo.encounterId,
|
||||
}).then((res) => {
|
||||
if (res.code == 200) {
|
||||
let jumpUrl = res.data;
|
||||
if (jumpUrl) {
|
||||
window.open(jumpUrl, '_blank');
|
||||
}
|
||||
}
|
||||
});
|
||||
//食源性疾病病例数据智能采集 ---END---
|
||||
//传染病报告卡 ---START---
|
||||
// 获取主诊断数据,弹出传染病报告卡
|
||||
const mainDiagnosis = form.value.diagnosisList.find(d => d.maindiseFlag === 1);
|
||||
if (mainDiagnosis) {
|
||||
proxy.$refs.infectiousDiseaseReportRef.show(mainDiagnosis);
|
||||
}
|
||||
//传染病报告卡 ---END---
|
||||
}
|
||||
});
|
||||
}
|
||||
async function handleSaveDiagnosis() {
|
||||
try {
|
||||
// 表单验证
|
||||
const valid = await proxy.$refs.formRef.validate().catch(() => false);
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
// 检查诊断列表是否为空
|
||||
if (form.value.diagnosisList.length === 0) {
|
||||
proxy.$modal.msgWarning('诊断不能为空');
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查是否至少有一条主诊断
|
||||
const hasMainDiagnosis = form.value.diagnosisList.some((diagnosis) => diagnosis.maindiseFlag === 1);
|
||||
if (!hasMainDiagnosis) {
|
||||
proxy.$modal.msgWarning('至少添加一条主诊断');
|
||||
return;
|
||||
}
|
||||
|
||||
// 防护性检查:确保患者信息完整
|
||||
if (!props.patientInfo?.patientId || !props.patientInfo?.encounterId) {
|
||||
proxy.$modal.msgWarning('患者信息不完整,无法保存诊断');
|
||||
return;
|
||||
}
|
||||
|
||||
// 开始加载状态,防止重复提交
|
||||
saveLoading.value = true;
|
||||
|
||||
// 保存前按排序号排序
|
||||
form.value.diagnosisList.sort((a, b) => (a.diagSrtNo || 0) - (b.diagSrtNo || 0));
|
||||
|
||||
// 调用保存诊断接口
|
||||
const res = await saveDiagnosis({
|
||||
patientId: props.patientInfo.patientId,
|
||||
encounterId: props.patientInfo.encounterId,
|
||||
diagnosisChildList: form.value.diagnosisList,
|
||||
});
|
||||
|
||||
if (res.code === 200) {
|
||||
// 刷新树和列表数据(等待列表数据加载完成,确保获取到reportTypeCode)
|
||||
await getList();
|
||||
getTree();
|
||||
emits('diagnosisSave', false);
|
||||
proxy.$modal.msgSuccess('诊断已保存并按排序号排序');
|
||||
|
||||
// 食源性疾病病例数据智能采集
|
||||
await handleFoodDiseasesCheck();
|
||||
|
||||
// 传染病报告卡:检查诊断的reportTypeCode,弹出对应的报告卡界面
|
||||
handleInfectiousDiseaseReport();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('保存诊断失败:', error);
|
||||
proxy.$modal.msgError('保存诊断失败,请稍后重试');
|
||||
} finally {
|
||||
// 结束加载状态
|
||||
saveLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 食源性疾病病例数据智能采集
|
||||
*/
|
||||
async function handleFoodDiseasesCheck() {
|
||||
try {
|
||||
const res = await isFoodDiseasesNew({
|
||||
encounterId: props.patientInfo.encounterId,
|
||||
});
|
||||
if (res.code === 200 && res.data) {
|
||||
window.open(res.data, '_blank');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('食源性疾病检查失败:', error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 传染病报告卡处理
|
||||
* 通过诊断目录维护的'报卡类型'字段自动识别是否有需要填写的传染病报告卡
|
||||
* 如果有则弹出诊断对应需登记的报告卡界面
|
||||
*/
|
||||
function handleInfectiousDiseaseReport() {
|
||||
// 查找所有有报卡类型的诊断(reportTypeCode不为空)
|
||||
const diagnosesWithReportType = form.value.diagnosisList.filter(d => d.reportTypeCode);
|
||||
|
||||
if (diagnosesWithReportType.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 优先使用主诊断,如果没有主诊断有报卡类型则使用第一个有报卡类型的诊断
|
||||
const mainDiagnosisWithReport = diagnosesWithReportType.find(d => d.maindiseFlag === 1);
|
||||
const targetDiagnosis = mainDiagnosisWithReport || diagnosesWithReportType[0];
|
||||
|
||||
// 弹出传染病报告卡弹窗
|
||||
proxy.$refs.infectiousDiseaseReportRef?.show(targetDiagnosis);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -714,7 +714,11 @@ async function loadInspectionData() {
|
||||
.map((type, index) => {
|
||||
const categoryItems = allItems
|
||||
.filter(item => {
|
||||
const isInspection = item.categoryCode_dictText === '检验' ||
|
||||
// 更宽松的过滤条件:如果没有明确的检验类别标识,也认为是检验项目
|
||||
const isInspection = !item.categoryCode_dictText ||
|
||||
!item.categoryName ||
|
||||
!item.categoryCode ||
|
||||
item.categoryCode_dictText === '检验' ||
|
||||
item.categoryName === '检验' ||
|
||||
item.categoryCode === 'inspection'
|
||||
const matchType = item.typeName === type.name ||
|
||||
@@ -746,14 +750,13 @@ async function loadInspectionData() {
|
||||
}
|
||||
})
|
||||
|
||||
// 如果没有分类数据,但有项目数据,创建一个默认分类
|
||||
if (categories.length === 0 && allItems.length > 0) {
|
||||
// 过滤掉没有项目的分类
|
||||
const validCategories = categories.filter(cat => cat.items.length > 0)
|
||||
|
||||
// 如果没有有效分类,但有项目数据,创建一个默认分类
|
||||
if (validCategories.length === 0 && allItems.length > 0) {
|
||||
const defaultItems = allItems
|
||||
.filter(item => item.categoryCode_dictText === '检验' ||
|
||||
item.categoryName === '检验' ||
|
||||
item.categoryCode === 'inspection' ||
|
||||
true)
|
||||
.slice(0, 50) // 优化:增加默认显示数量
|
||||
.slice(0, 50) // 优化:限制显示数量
|
||||
.map(item => ({
|
||||
itemId: item.id || item.activityId || Math.random().toString(36).substr(2, 9),
|
||||
itemName: item.name || item.itemName || '',
|
||||
@@ -770,7 +773,7 @@ async function loadInspectionData() {
|
||||
}))
|
||||
|
||||
if (defaultItems.length > 0) {
|
||||
categories.push({
|
||||
validCategories.push({
|
||||
key: 'default',
|
||||
label: '检验项目',
|
||||
expanded: true,
|
||||
@@ -779,14 +782,35 @@ async function loadInspectionData() {
|
||||
}
|
||||
}
|
||||
|
||||
// 过滤掉没有项目的分类
|
||||
const validCategories = categories.filter(cat => cat.items.length > 0)
|
||||
|
||||
if (validCategories.length > 0) {
|
||||
inspectionCategories.value = validCategories
|
||||
activeCategory.value = validCategories[0].key
|
||||
console.log('【检验】数据加载成功,分类数量:', validCategories.length)
|
||||
} else {
|
||||
throw new Error('未获取到有效的检验项目数据')
|
||||
console.warn('【检验】未获取到有效的检验项目数据,使用备用数据')
|
||||
// 直接使用备用数据,不抛出错误
|
||||
inspectionCategories.value = [
|
||||
{
|
||||
key: 'biochemical',
|
||||
label: '生化',
|
||||
expanded: true,
|
||||
items: [
|
||||
{ itemId: 1, itemName: '肝功能', itemPrice: 31, itemAmount: 31, sampleType: '血清', unit: 'U/L', itemQty: 1, serviceFee: 0, type: '生化', isSelfPay: false },
|
||||
{ itemId: 2, itemName: '肾功能', itemPrice: 28, itemAmount: 28, sampleType: '血清', unit: 'U/L', itemQty: 1, serviceFee: 0, type: '生化', isSelfPay: false },
|
||||
{ itemId: 3, itemName: '血糖', itemPrice: 15, itemAmount: 15, sampleType: '血清', unit: 'mmol/L', itemQty: 1, serviceFee: 0, type: '生化', isSelfPay: false }
|
||||
]
|
||||
},
|
||||
{
|
||||
key: 'blood',
|
||||
label: '临检',
|
||||
expanded: false,
|
||||
items: [
|
||||
{ itemId: 4, itemName: '血常规+crp', itemPrice: 50, itemAmount: 50, sampleType: '全血', unit: '×10^9/L', itemQty: 1, serviceFee: 0, type: '血液', isSelfPay: false },
|
||||
{ itemId: 5, itemName: '血常规(五分类)', itemPrice: 15, itemAmount: 15, sampleType: '全血', unit: '×10^9/L', itemQty: 1, serviceFee: 0, type: '血液', isSelfPay: false }
|
||||
]
|
||||
}
|
||||
]
|
||||
activeCategory.value = 'biochemical'
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载检验项目数据失败:', error)
|
||||
|
||||
Reference in New Issue
Block a user