修复了作废的中医诊断也显示出来的问题,
This commit is contained in:
@@ -91,6 +91,8 @@ import {
|
|||||||
getTcmCondition,
|
getTcmCondition,
|
||||||
getTcmSyndrome,
|
getTcmSyndrome,
|
||||||
saveTcmDiagnosis,
|
saveTcmDiagnosis,
|
||||||
|
deleteTcmDiagnosis,
|
||||||
|
getTcmDiagnosis,
|
||||||
} from '@/views/doctorstation/components/api';
|
} from '@/views/doctorstation/components/api';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -115,9 +117,38 @@ const { proxy } = getCurrentInstance();
|
|||||||
const emit = defineEmits(['close']);
|
const emit = defineEmits(['close']);
|
||||||
|
|
||||||
function handleOpen() {
|
function handleOpen() {
|
||||||
|
// 加载诊断和证候选项
|
||||||
getTcmCondition().then((res) => {
|
getTcmCondition().then((res) => {
|
||||||
conditionList.value = res.data.records;
|
conditionList.value = res.data.records;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 加载已保存的中医诊断
|
||||||
|
getTcmDiagnosis({ encounterId: props.patientInfo.encounterId }).then((res) => {
|
||||||
|
if (res.data && res.data.illness && res.data.illness.length > 0) {
|
||||||
|
tcmDiagonsisList.value = [];
|
||||||
|
tcmDiagonsisSaveList.value = [];
|
||||||
|
|
||||||
|
res.data.illness.forEach((illness, index) => {
|
||||||
|
const symptom = res.data.symptom[index];
|
||||||
|
const syndromeGroupNo = illness.syndromeGroupNo || symptom.syndromeGroupNo;
|
||||||
|
|
||||||
|
tcmDiagonsisList.value.push({
|
||||||
|
conditionName: illness.name,
|
||||||
|
syndromeName: symptom.name,
|
||||||
|
syndromeGroupNo: syndromeGroupNo,
|
||||||
|
isSaved: true, // 标记为已保存的诊断
|
||||||
|
});
|
||||||
|
|
||||||
|
tcmDiagonsisSaveList.value.push({
|
||||||
|
definitionId: illness.definitionId,
|
||||||
|
syndromeGroupNo: syndromeGroupNo,
|
||||||
|
isSaved: true,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).catch((error) => {
|
||||||
|
console.error('加载中医诊断失败:', error);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 点击诊断列表处理,点击以后才显示证候列表
|
// 点击诊断列表处理,点击以后才显示证候列表
|
||||||
@@ -155,10 +186,34 @@ function clickSyndromeRow(row) {
|
|||||||
|
|
||||||
// 删除诊断
|
// 删除诊断
|
||||||
function removeDiagnosis(row, index) {
|
function removeDiagnosis(row, index) {
|
||||||
tcmDiagonsisList.value.splice(index, 1);
|
// 如果是已保存的诊断,需要调用API从服务器删除
|
||||||
tcmDiagonsisSaveList.value = tcmDiagonsisSaveList.filter((item) => {
|
if (row.isSaved && row.syndromeGroupNo) {
|
||||||
return item.syndromeGroupNo !== row.syndromeGroupNo;
|
proxy.$modal.confirm('确定要删除这个中医诊断吗?').then(() => {
|
||||||
});
|
deleteTcmDiagnosis(row.syndromeGroupNo).then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
proxy.$modal.msgSuccess('删除成功');
|
||||||
|
// 从列表中移除
|
||||||
|
tcmDiagonsisList.value.splice(index, 1);
|
||||||
|
tcmDiagonsisSaveList.value = tcmDiagonsisSaveList.value.filter((item) => {
|
||||||
|
return item.syndromeGroupNo !== row.syndromeGroupNo;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
proxy.$modal.msgError(res.msg || '删除失败');
|
||||||
|
}
|
||||||
|
}).catch((error) => {
|
||||||
|
console.error('删除中医诊断失败:', error);
|
||||||
|
proxy.$modal.msgError('删除失败,请重试');
|
||||||
|
});
|
||||||
|
}).catch(() => {
|
||||||
|
// 用户取消删除
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// 未保存的诊断,直接从数组中删除
|
||||||
|
tcmDiagonsisList.value.splice(index, 1);
|
||||||
|
tcmDiagonsisSaveList.value = tcmDiagonsisSaveList.value.filter((item) => {
|
||||||
|
return item.syndromeGroupNo !== row.syndromeGroupNo;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
|
|||||||
@@ -401,7 +401,7 @@
|
|||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<tcmdiagnosisDialog ref="tcmDianosis" :patientInfo="props.patientInfo" @flush="getListInfo()" />
|
<tcmdiagnosisDialog ref="tcmDianosis" :patientInfo="props.patientInfo" @flush="handleDiagnosisFlush()" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -414,6 +414,7 @@ import {
|
|||||||
getOrgTree,
|
getOrgTree,
|
||||||
signTcmAdvice,
|
signTcmAdvice,
|
||||||
getTcmDiagnosis,
|
getTcmDiagnosis,
|
||||||
|
deleteTcmDiagnosis,
|
||||||
signOutTcmAdvice,
|
signOutTcmAdvice,
|
||||||
updateGroupId,
|
updateGroupId,
|
||||||
getContract,
|
getContract,
|
||||||
@@ -645,13 +646,15 @@ function getListInfo(addNewRow) {
|
|||||||
function getDiagnosisInfo() {
|
function getDiagnosisInfo() {
|
||||||
diagnosisList.value = [];
|
diagnosisList.value = [];
|
||||||
getTcmDiagnosis({ encounterId: props.patientInfo.encounterId }).then((res) => {
|
getTcmDiagnosis({ encounterId: props.patientInfo.encounterId }).then((res) => {
|
||||||
if (res.data.illness.length > 0) {
|
if (res.data.illness && res.data.illness.length > 0) {
|
||||||
res.data.illness.forEach((item, index) => {
|
res.data.illness.forEach((item, index) => {
|
||||||
diagnosisList.value.push({
|
diagnosisList.value.push({
|
||||||
name: item.name + '-' + res.data.symptom[index].name,
|
name: item.name + '-' + res.data.symptom[index].name,
|
||||||
definitionId: item.definitionId,
|
definitionId: item.definitionId,
|
||||||
encounterDiagnosisId: item.encounterDiagnosisId,
|
encounterDiagnosisId: item.encounterDiagnosisId,
|
||||||
conditionId: item.conditionId,
|
conditionId: item.conditionId,
|
||||||
|
syndromeGroupNo: item.syndromeGroupNo || res.data.symptom[index].syndromeGroupNo, // 保存syndromeGroupNo用于删除
|
||||||
|
...item, // 保存完整的item数据
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -752,19 +755,31 @@ function openDialog() {
|
|||||||
tcmDianosis.value.openDialog();
|
tcmDianosis.value.openDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteDiagnosisBind(id) {
|
function deleteDiagnosisBind(syndromeGroupNo) {
|
||||||
const data = localStorage.getItem(`tcmDiagnosisList_${props.patientInfo.encounterId}`);
|
if (!syndromeGroupNo) {
|
||||||
let list = [];
|
proxy.$modal.msgWarning('缺少诊断标识,无法删除');
|
||||||
list = JSON.parse(data);
|
return;
|
||||||
// 添加到列表
|
}
|
||||||
const index = list.findIndex((item) => item.id === id);
|
|
||||||
if (index === -1) return;
|
|
||||||
|
|
||||||
list.splice(index, 1);
|
// 调用API从服务器删除中医诊断
|
||||||
localStorage.removeItem(`tcmDiagnosisList_${props.patientInfo.encounterId}`);
|
deleteTcmDiagnosis(syndromeGroupNo).then((res) => {
|
||||||
// 保存到本地缓存
|
if (res.code === 200) {
|
||||||
localStorage.setItem(`tcmDiagnosisList_${props.patientInfo.encounterId}`, JSON.stringify(list));
|
proxy.$modal.msgSuccess('删除成功');
|
||||||
|
handleDiagnosisFlush();
|
||||||
|
} else {
|
||||||
|
proxy.$modal.msgError(res.msg || '删除失败');
|
||||||
|
}
|
||||||
|
}).catch((error) => {
|
||||||
|
console.error('删除中医诊断失败:', error);
|
||||||
|
proxy.$modal.msgError('删除失败,请重试');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 诊断数据刷新处理函数
|
||||||
|
function handleDiagnosisFlush() {
|
||||||
|
// 同时刷新医嘱列表和诊断列表,确保诊断数据同步
|
||||||
getListInfo();
|
getListInfo();
|
||||||
|
getDiagnosisInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
function addNewPrescription(){
|
function addNewPrescription(){
|
||||||
|
|||||||
@@ -82,28 +82,29 @@ function submit() {
|
|||||||
return; // 确保选择了诊断和证候
|
return; // 确保选择了诊断和证候
|
||||||
}
|
}
|
||||||
|
|
||||||
// 构建诊断对象
|
// 构建诊断数据,调用API保存到服务器
|
||||||
const diagnosis = {
|
const diagnosisChildList = [{
|
||||||
id: Date.now(), // 使用时间戳作为唯一ID
|
|
||||||
condition: conditionOptions.value.find((item) => item.value === condition.value)?.label || '',
|
|
||||||
conditionCode: condition.value,
|
conditionCode: condition.value,
|
||||||
syndrome: syndromeOptions.value.find((item) => item.value === syndrome.value)?.label || '',
|
|
||||||
syndromeCode: syndrome.value,
|
syndromeCode: syndrome.value,
|
||||||
};
|
}];
|
||||||
const data = localStorage.getItem(`tcmDiagnosisList_${props.patientInfo.encounterId}`);
|
|
||||||
diagnosisList.value = JSON.parse(data);
|
|
||||||
// 添加到列表
|
|
||||||
diagnosisList.value.push(diagnosis);
|
|
||||||
localStorage.removeItem(`tcmDiagnosisList_${props.patientInfo.encounterId}`);
|
|
||||||
// 保存到本地缓存
|
|
||||||
localStorage.setItem(
|
|
||||||
`tcmDiagnosisList_${props.patientInfo.encounterId}`,
|
|
||||||
JSON.stringify(diagnosisList.value)
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log('当前诊断列表:', diagnosisList.value);
|
// 调用API保存到服务器
|
||||||
emit('flush')
|
saveTcmDiagnosis({
|
||||||
close();
|
patientId: props.patientInfo.patientId,
|
||||||
|
encounterId: props.patientInfo.encounterId,
|
||||||
|
diagnosisChildList: diagnosisChildList,
|
||||||
|
}).then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
proxy.$modal.msgSuccess('保存成功');
|
||||||
|
emit('flush');
|
||||||
|
close();
|
||||||
|
} else {
|
||||||
|
proxy.$modal.msgError(res.msg || '保存失败');
|
||||||
|
}
|
||||||
|
}).catch((error) => {
|
||||||
|
console.error('保存中医诊断失败:', error);
|
||||||
|
proxy.$modal.msgError('保存失败,请重试');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function openDialog() {
|
function openDialog() {
|
||||||
|
|||||||
Reference in New Issue
Block a user