Merge branch 'develop' of https://gitea.gentronhealth.com/wangyizhe/his into develop
This commit is contained in:
@@ -167,8 +167,29 @@ const handleNodeClick = (data, node) => {
|
||||
if (node.isLeaf) {
|
||||
// 存储当前节点数据
|
||||
currentSelectTemplate.value = data.document;
|
||||
currentComponent.value = currentSelectTemplate.value.vueRouter || '';
|
||||
// currentComponent.value = data.document.vueRouter || '';
|
||||
|
||||
// 在切换组件前先重置表单数据,避免显示之前的数据
|
||||
editForm.value = {
|
||||
id: '',
|
||||
definitionId: '',
|
||||
definitionBusNo: '',
|
||||
contentJson: '',
|
||||
statusEnum: 1,
|
||||
organizationId: 0,
|
||||
encounterId: '',
|
||||
patientId: '',
|
||||
recordTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||
createBy: '',
|
||||
source: '',
|
||||
};
|
||||
|
||||
// 先清空当前组件,再设置新组件,确保组件完全重新渲染
|
||||
currentComponent.value = '';
|
||||
|
||||
// 使用 nextTick 确保 DOM 更新后再设置新组件
|
||||
nextTick(() => {
|
||||
currentComponent.value = currentSelectTemplate.value.vueRouter || '';
|
||||
});
|
||||
} else {
|
||||
currentSelectTemplate.value = {
|
||||
id: '',
|
||||
@@ -426,8 +447,21 @@ const loadLatestMedicalRecord = async () => {
|
||||
// 自动回显最新病历数据到模板
|
||||
editForm.value = latestRecord;
|
||||
nextTick(() => {
|
||||
if (emrComponentRef.value && latestRecord.contentJson) {
|
||||
emrComponentRef.value.setFormData(JSON.parse(latestRecord.contentJson));
|
||||
if (emrComponentRef.value) {
|
||||
// 确保动态组件已加载完成后再设置数据
|
||||
if (latestRecord.contentJson) {
|
||||
try {
|
||||
const parsedData = JSON.parse(latestRecord.contentJson);
|
||||
emrComponentRef.value.setFormData(parsedData);
|
||||
} catch (parseError) {
|
||||
console.error('解析病历数据失败:', parseError);
|
||||
// 解析失败时仍然尝试设置空数据以清空之前的残留数据
|
||||
emrComponentRef.value.setFormData({});
|
||||
}
|
||||
} else {
|
||||
// 如果没有内容数据,也要清空组件中的数据
|
||||
emrComponentRef.value.setFormData({});
|
||||
}
|
||||
}
|
||||
|
||||
// 通知History组件更新选中状态
|
||||
@@ -438,11 +472,51 @@ const loadLatestMedicalRecord = async () => {
|
||||
} else {
|
||||
// 清空选中状态
|
||||
selectedHistoryRecordId.value = '';
|
||||
// 当没有历史记录时,也要清空当前表单数据,避免显示之前患者的数据
|
||||
editForm.value = {
|
||||
id: '',
|
||||
definitionId: '',
|
||||
definitionBusNo: '',
|
||||
contentJson: '',
|
||||
statusEnum: 1,
|
||||
organizationId: 0,
|
||||
encounterId: '',
|
||||
patientId: '',
|
||||
recordTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||
createBy: '',
|
||||
source: '',
|
||||
};
|
||||
|
||||
nextTick(() => {
|
||||
if (emrComponentRef.value) {
|
||||
emrComponentRef.value.setFormData({});
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error('加载最新病历数据失败');
|
||||
// 出错时也清空选中状态
|
||||
selectedHistoryRecordId.value = '';
|
||||
// 出错时也要清空表单数据,避免显示之前患者的数据
|
||||
editForm.value = {
|
||||
id: '',
|
||||
definitionId: '',
|
||||
definitionBusNo: '',
|
||||
contentJson: '',
|
||||
statusEnum: 1,
|
||||
organizationId: 0,
|
||||
encounterId: '',
|
||||
patientId: '',
|
||||
recordTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||
createBy: '',
|
||||
source: '',
|
||||
};
|
||||
|
||||
nextTick(() => {
|
||||
if (emrComponentRef.value) {
|
||||
emrComponentRef.value.setFormData({});
|
||||
}
|
||||
});
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
@@ -689,6 +763,22 @@ watch(
|
||||
(newPatientInfo) => {
|
||||
// 当患者信息变化时,默认选中门诊病历模板并加载最新病历数据
|
||||
if (newPatientInfo && newPatientInfo.patientId && Object.keys(newPatientInfo).length > 0) {
|
||||
// 重置当前组件和表单数据,确保不会显示之前患者的数据
|
||||
currentComponent.value = '';
|
||||
editForm.value = {
|
||||
id: '',
|
||||
definitionId: '',
|
||||
definitionBusNo: '',
|
||||
contentJson: '',
|
||||
statusEnum: 1,
|
||||
organizationId: 0,
|
||||
encounterId: '',
|
||||
patientId: '',
|
||||
recordTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||
createBy: '',
|
||||
source: '',
|
||||
};
|
||||
|
||||
// 确保模板树已经加载
|
||||
if (templateData.value && templateData.value.length > 0) {
|
||||
// 优先尝试使用更精确的selectDefaultTemplate函数
|
||||
@@ -702,6 +792,22 @@ watch(
|
||||
});
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// 如果没有患者信息,也要重置组件和表单数据
|
||||
currentComponent.value = '';
|
||||
editForm.value = {
|
||||
id: '',
|
||||
definitionId: '',
|
||||
definitionBusNo: '',
|
||||
contentJson: '',
|
||||
statusEnum: 1,
|
||||
organizationId: 0,
|
||||
encounterId: '',
|
||||
patientId: '',
|
||||
recordTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||
createBy: '',
|
||||
source: '',
|
||||
};
|
||||
}
|
||||
},
|
||||
{ deep: true, immediate: true }
|
||||
|
||||
@@ -356,265 +356,39 @@
|
||||
</template>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- 剂量单位 -->
|
||||
<el-select
|
||||
v-model="scope.row.unitCode"
|
||||
style="width: 70px; margin-right: 20px"
|
||||
placeholder=" "
|
||||
>
|
||||
<template
|
||||
v-for="item in scope.row.unitCodeList"
|
||||
:key="item.value"
|
||||
>
|
||||
<el-option
|
||||
v-if="item.type == unitMap['minUnit']"
|
||||
:value="item.value"
|
||||
:label="item.label"
|
||||
/>
|
||||
</template>
|
||||
</el-select>
|
||||
<span>=</span>
|
||||
<!-- 单次剂量 -->
|
||||
<el-form-item prop="dose" class="required-field" data-prop="dose">
|
||||
<el-input-number
|
||||
v-model="scope.row.dose"
|
||||
controls-position="right"
|
||||
:controls="false"
|
||||
style="width: 70px; margin: 0 20px"
|
||||
:ref="
|
||||
(el) => {
|
||||
if (!inputRefs[scope.$index])
|
||||
inputRefs[scope.$index] = {};
|
||||
inputRefs[scope.$index].dose = el;
|
||||
}
|
||||
"
|
||||
@input="convertDoseValues(scope.row, scope.$index)"
|
||||
@keyup.enter.prevent="
|
||||
handleEnter(
|
||||
'dose',
|
||||
scope.row,
|
||||
scope.$index,
|
||||
prescription.id
|
||||
)
|
||||
"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- 全部单位 -->
|
||||
<el-select
|
||||
v-model="scope.row.doseUnitCode"
|
||||
style="width: 70px"
|
||||
placeholder=" "
|
||||
@change="convertValues(scope.row, scope.$index)"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in scope.row.unitCodeList"
|
||||
:value="item.value"
|
||||
:label="item.label"
|
||||
:key="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<el-form-item
|
||||
label="给药途径:"
|
||||
prop="methodCode"
|
||||
class="required-field"
|
||||
data-prop="methodCode"
|
||||
>
|
||||
<el-select
|
||||
v-model="scope.row.methodCode"
|
||||
placeholder="给药途径"
|
||||
clearable
|
||||
filterable
|
||||
:ref="
|
||||
(el) => {
|
||||
if (!inputRefs[scope.$index])
|
||||
inputRefs[scope.$index] = {};
|
||||
inputRefs[scope.$index].methodCode = el;
|
||||
}
|
||||
"
|
||||
@keyup.enter.prevent="
|
||||
() => {
|
||||
inputRefs[scope.$index]?.methodCode?.blur();
|
||||
}
|
||||
"
|
||||
@visible-change="
|
||||
(value) => {
|
||||
if (!value) {
|
||||
handleEnter('methodCode', scope.row, scope.$index);
|
||||
}
|
||||
}
|
||||
"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in method_code"
|
||||
@click="() => (scope.row.methodCode_dictText = dict.label)"
|
||||
@keyup="handleEnter('methodCode', scope.row, scope.$index)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="用药频次:"
|
||||
prop="rateCode"
|
||||
class="required-field"
|
||||
data-prop="rateCode"
|
||||
>
|
||||
<el-select
|
||||
v-model="scope.row.rateCode"
|
||||
placeholder="频次"
|
||||
style="width: 120px"
|
||||
filterable
|
||||
@keyup.enter.prevent="
|
||||
() => {
|
||||
inputRefs[scope.$index]?.rateCode?.blur();
|
||||
}
|
||||
"
|
||||
@change="calculateTotalAmount(scope.row, scope.$index)"
|
||||
@visible-change="
|
||||
(value) => {
|
||||
if (!value) {
|
||||
handleEnter('rateCode', scope.row, scope.$index);
|
||||
}
|
||||
// inputRefs.rateCode.blur();
|
||||
}
|
||||
"
|
||||
:ref="
|
||||
(el) => {
|
||||
if (!inputRefs[scope.$index])
|
||||
inputRefs[scope.$index] = {};
|
||||
inputRefs[scope.$index].rateCode = el;
|
||||
}
|
||||
"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in rate_code"
|
||||
@click="() => (scope.row.rateCode_dictText = dict.label)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="备注:"
|
||||
prop="remarks"
|
||||
style="margin: 0; margin-right: 20px"
|
||||
>
|
||||
<el-input
|
||||
v-model="scope.row.remarks"
|
||||
placeholder="请输入备注"
|
||||
maxlength="100"
|
||||
show-word-limit
|
||||
style="width: 200px"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
style="
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 10px;
|
||||
"
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
style="
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 10px;
|
||||
"
|
||||
>
|
||||
<div class="form-group">
|
||||
<el-form-item
|
||||
label="备注:"
|
||||
prop="remarks"
|
||||
style="margin: 0; margin-right: 20px"
|
||||
>
|
||||
<div class="form-group">
|
||||
<el-form-item
|
||||
label="用药天数:"
|
||||
prop="dispensePerDuration"
|
||||
class="required-field"
|
||||
data-prop="dispensePerDuration"
|
||||
>
|
||||
<el-input-number
|
||||
v-model="scope.row.dispensePerDuration"
|
||||
style="width: 80px"
|
||||
:min="1"
|
||||
controls-position="right"
|
||||
:controls="false"
|
||||
:ref="
|
||||
(el) => {
|
||||
if (!inputRefs[scope.$index])
|
||||
inputRefs[scope.$index] = {};
|
||||
inputRefs[scope.$index].dispensePerDuration = el;
|
||||
}
|
||||
"
|
||||
@keyup.enter.prevent="
|
||||
handleEnter('dispensePerDuration', scope.row, scope.$index)
|
||||
"
|
||||
@input="calculateTotalAmount(scope.row, scope.$index)"
|
||||
>
|
||||
<template #suffix>天</template>
|
||||
</el-input-number>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item
|
||||
label="总量:"
|
||||
prop="quantity"
|
||||
class="required-field"
|
||||
data-prop="quantity"
|
||||
>
|
||||
<el-input-number
|
||||
v-model="scope.row.quantity"
|
||||
style="width: 70px"
|
||||
controls-position="right"
|
||||
:controls="false"
|
||||
:ref="
|
||||
(el) => {
|
||||
if (!inputRefs[scope.$index])
|
||||
inputRefs[scope.$index] = {};
|
||||
inputRefs[scope.$index].quantity = el;
|
||||
}
|
||||
"
|
||||
@keyup.enter.prevent="
|
||||
handleEnter(
|
||||
'quantity',
|
||||
scope.row,
|
||||
scope.$index,
|
||||
prescription.id
|
||||
)
|
||||
"
|
||||
@input="calculateTotalPrice(scope.row, scope.$index)"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-select
|
||||
v-model="scope.row.unitCode"
|
||||
style="width: 70px; margin-right: 20px"
|
||||
placeholder=" "
|
||||
@change="calculateTotalAmount(scope.row, scope.$index)"
|
||||
>
|
||||
<template
|
||||
v-for="item in scope.row.unitCodeList"
|
||||
:key="item.value"
|
||||
>
|
||||
<el-option
|
||||
v-if="checkUnit(item, scope.row)"
|
||||
:value="item.value"
|
||||
:label="item.label"
|
||||
@click="
|
||||
() => {
|
||||
if (item.type == unitMap['minUnit']) {
|
||||
scope.row.unitPrice = scope.row.minUnitPrice;
|
||||
} else {
|
||||
scope.row.unitPrice = scope.row.unitTempPrice;
|
||||
}
|
||||
scope.row.unitCode_dictText = item.label;
|
||||
}
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
</el-select>
|
||||
</div>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="handleSaveSign(scope.row, scope.$index, prescription.id)"
|
||||
>
|
||||
确定
|
||||
</el-button>
|
||||
</div>
|
||||
<el-input
|
||||
v-model="scope.row.remarks"
|
||||
placeholder="请输入备注"
|
||||
maxlength="100"
|
||||
show-word-limit
|
||||
style="width: 500px"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="handleSaveSign(scope.row, scope.$index)"
|
||||
>
|
||||
确定
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="scope.row.adviceType == 2">
|
||||
<div
|
||||
@@ -693,7 +467,7 @@
|
||||
}}
|
||||
</span>
|
||||
</div>
|
||||
<el-button type="primary" @click="handleSaveSign(scope.row, scope.$index, prescription.id)">
|
||||
<el-button type="primary" @click="handleSaveSign(scope.row, scope.$index)">
|
||||
确定
|
||||
</el-button>
|
||||
</template>
|
||||
@@ -1152,6 +926,12 @@ const adviceTypeList = ref([
|
||||
},
|
||||
]);
|
||||
|
||||
// 根据类型值获取显示标签,避免非编辑态出现空标签
|
||||
const mapAdviceTypeLabel = (type) => {
|
||||
const found = adviceTypeList.value.find((item) => item.value === type);
|
||||
return found ? found.label : '';
|
||||
};
|
||||
|
||||
// 西药处方管理相关变量
|
||||
const westernPrescriptions = ref([]); // 西药处方列表
|
||||
const currentPrescriptionId = ref(null); // 当前活跃的处方ID
|
||||
@@ -2321,6 +2101,8 @@ function handleSaveSign(row, index, prescriptionId) {
|
||||
row.patientId = props.patientInfo.patientId;
|
||||
row.encounterId = props.patientInfo.encounterId;
|
||||
row.accountId = accountId.value;
|
||||
// 确保非编辑态显示正确的医嘱类型标签
|
||||
row.adviceType_dictText = mapAdviceTypeLabel(row.adviceType);
|
||||
if (row.adviceType == 1 || row.adviceType == 2) {
|
||||
row.minUnitQuantity =
|
||||
row.minUnitCode == row.unitCode ? row.quantity : row.quantity * row.partPercent;
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
</el-row>
|
||||
<el-row :gutter="10" class="mb8" v-else>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="submitAudit"
|
||||
>提交审核</el-button
|
||||
>
|
||||
<el-button type="primary" plain icon="Plus" @click="submitAudit">
|
||||
提交审核
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="EditPen" @click="handleTotalAmount">
|
||||
@@ -35,7 +35,8 @@
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleSave"
|
||||
>批量保存</el-button
|
||||
>批量保存
|
||||
</el-button
|
||||
>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -271,11 +272,11 @@
|
||||
>
|
||||
<div class="select_wrapper_div">
|
||||
<el-select
|
||||
v-if="viewStatus !== 'view'"
|
||||
v-model="scope.row.purposeLocationId"
|
||||
placeholder="请选择仓库"
|
||||
:class="{ 'error-border': scope.row.error }"
|
||||
clearable
|
||||
:disabled="viewStatus == 'view'"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) in locationList"
|
||||
@@ -285,8 +286,19 @@
|
||||
@click="handleLocationClick(item, scope.row, scope.$index)"
|
||||
/>
|
||||
</el-select>
|
||||
|
||||
<!-- 非编辑状态下显示为只读输入框 -->
|
||||
<el-input
|
||||
v-else
|
||||
:model-value="getLocationNameById(scope.row.purposeLocationId)"
|
||||
readonly
|
||||
disabled
|
||||
:placeholder="'-'"
|
||||
class="readonly-input" style="pointer-events: none;"
|
||||
/>
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@@ -724,7 +736,27 @@ const {
|
||||
"specialty_code",
|
||||
"purchase_type"
|
||||
);
|
||||
//
|
||||
// // 监听locationList变化,重新处理已存在的数据
|
||||
// watch(locationList, (newList) => {
|
||||
// if (newList && newList.length > 0) {
|
||||
// // 可以触发表格重新渲染或更新相关数据
|
||||
// }
|
||||
// }, { immediate: true });
|
||||
const getLocationNameById = (id) => {
|
||||
|
||||
// 检查locationList是否已加载
|
||||
if (!locationList.value || !Array.isArray(locationList.value) || locationList.value.length === 0) {
|
||||
return '仓库列表未加载';
|
||||
}
|
||||
|
||||
// 使用严格相等比较,处理类型转换
|
||||
const location = locationList.value.find(item => {
|
||||
return item.id == id; // 使用 == 而不是 === 以处理字符串和数字之间的比较
|
||||
});
|
||||
|
||||
return location ? location.name : '仓库不存在';
|
||||
};
|
||||
const viewStatus = ref("");
|
||||
const startTimeOld = ref("");
|
||||
const endTimeOld = ref("");
|
||||
|
||||
@@ -205,9 +205,9 @@
|
||||
>
|
||||
<template #default="scope">
|
||||
<!-- v-hasPermi="['system:user:edit']" -->
|
||||
<el-button link type="primary" icon="View" @click.stop="handleUpdate(scope.row, 'view')"
|
||||
>详情</el-button
|
||||
>
|
||||
<el-button link type="primary" icon="View" @click.stop="handleUpdate(scope.row, 'view')">
|
||||
详情
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@@ -588,6 +588,7 @@ function handleUpdate(row, view) {
|
||||
// 采购入库
|
||||
editRow.value = row;
|
||||
getpurchaseInventoryDetail(row.supplyBusNo).then((response) => {
|
||||
console.log('返回的数据,response:', response.data)
|
||||
currentData.value = response.data;
|
||||
// nextTick(() => {
|
||||
// proxy.$refs['inventoryReceiptRef'].edit();
|
||||
@@ -604,7 +605,6 @@ function handleUpdate(row, view) {
|
||||
path: 'purchaseDocument',
|
||||
});
|
||||
}
|
||||
|
||||
getList();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user