Merge remote-tracking branch 'origin/develop' into guanyu

This commit is contained in:
2026-06-16 12:27:30 +08:00
9 changed files with 461 additions and 276 deletions

View File

@@ -191,10 +191,15 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
QueryWrapper<InpatientAdviceParam> queryWrapper QueryWrapper<InpatientAdviceParam> queryWrapper
= HisQueryUtils.buildQueryWrapper(inpatientAdviceParam, null, null, null); = HisQueryUtils.buildQueryWrapper(inpatientAdviceParam, null, null, null);
// 手动拼接requestStatus条件COMPLETED(3)时同时包含CHECK_VERIFIED(10)和PENDING_RECEIVE(11) // 手动拼接requestStatus条件
// 1. ACTIVE(2)时:同时包含已停嘱待核对的 PENDING_STOP(13)
// 2. COMPLETED(3)时:同时包含已校对检查 CHECK_VERIFIED(10) 和已接收 PENDING_RECEIVE(11)
// UNION查询外层列名为request_statusT1.status_enum AS request_status不是status_enum // UNION查询外层列名为request_statusT1.status_enum AS request_status不是status_enum
if (requestStatus != null) { if (requestStatus != null) {
if (RequestStatus.COMPLETED.getValue().equals(requestStatus)) { if (RequestStatus.ACTIVE.getValue().equals(requestStatus)) {
queryWrapper.in("request_status",
RequestStatus.ACTIVE.getValue(), RequestStatus.PENDING_STOP.getValue());
} else if (RequestStatus.COMPLETED.getValue().equals(requestStatus)) {
queryWrapper.in("request_status", queryWrapper.in("request_status",
RequestStatus.COMPLETED.getValue(), RequestStatus.CHECK_VERIFIED.getValue(), RequestStatus.COMPLETED.getValue(), RequestStatus.CHECK_VERIFIED.getValue(),
RequestStatus.PENDING_RECEIVE.getValue()); RequestStatus.PENDING_RECEIVE.getValue());
@@ -414,14 +419,30 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
Date checkDate = new Date(); Date checkDate = new Date();
if (!serviceRequestList.isEmpty()) { if (!serviceRequestList.isEmpty()) {
List<Long> serviceReqIds = serviceRequestList.stream().map(PerformInfoDto::getRequestId).toList(); List<Long> serviceReqIds = serviceRequestList.stream().map(PerformInfoDto::getRequestId).toList();
// 先查询服务请求,按 categoryEnum 分流:检查类(23)走 CHECK_VERIFIED其余走 COMPLETED // 先查询服务请求,进行状态分流:
// 1. 如果是停嘱待核对(PENDING_STOP=13),则核对后转为停止(STOPPED=6)
// 2. 否则按类别分流:检查类(23)走 CHECK_VERIFIED其余走 COMPLETED
List<ServiceRequest> allServiceRequests = serviceRequestService.listByIds(serviceReqIds); List<ServiceRequest> allServiceRequests = serviceRequestService.listByIds(serviceReqIds);
List<Long> stopReqIds = allServiceRequests.stream()
.filter(sr -> RequestStatus.PENDING_STOP.getValue().equals(sr.getStatusEnum()))
.map(ServiceRequest::getId).toList();
List<Long> checkReqIds = allServiceRequests.stream() List<Long> checkReqIds = allServiceRequests.stream()
.filter(sr -> ActivityDefCategory.TEST.getValue().equals(sr.getCategoryEnum())) .filter(sr -> !RequestStatus.PENDING_STOP.getValue().equals(sr.getStatusEnum())
&& ActivityDefCategory.TEST.getValue().equals(sr.getCategoryEnum()))
.map(ServiceRequest::getId).toList(); .map(ServiceRequest::getId).toList();
List<Long> otherReqIds = allServiceRequests.stream() List<Long> otherReqIds = allServiceRequests.stream()
.filter(sr -> !ActivityDefCategory.TEST.getValue().equals(sr.getCategoryEnum())) .filter(sr -> !RequestStatus.PENDING_STOP.getValue().equals(sr.getStatusEnum())
&& !ActivityDefCategory.TEST.getValue().equals(sr.getCategoryEnum()))
.map(ServiceRequest::getId).toList(); .map(ServiceRequest::getId).toList();
// 停嘱待核对 → 停止STOPPED=6
if (!stopReqIds.isEmpty()) {
serviceRequestService.update(new LambdaUpdateWrapper<ServiceRequest>()
.in(ServiceRequest::getId, stopReqIds)
.set(ServiceRequest::getStatusEnum, RequestStatus.STOPPED.getValue())
.set(ServiceRequest::getPerformerCheckId, practitionerId)
.set(ServiceRequest::getCheckTime, checkDate));
}
// 检查类 → 已校对CHECK_VERIFIED=10 // 检查类 → 已校对CHECK_VERIFIED=10
if (!checkReqIds.isEmpty()) { if (!checkReqIds.isEmpty()) {
serviceRequestService.updateCheckVerifiedStatus(checkReqIds, practitionerId, checkDate); serviceRequestService.updateCheckVerifiedStatus(checkReqIds, practitionerId, checkDate);
@@ -442,14 +463,50 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
} }
} }
if (!medRequestList.isEmpty()) { if (!medRequestList.isEmpty()) {
// 更新药品请求状态已完成 List<Long> medReqIds = medRequestList.stream().map(PerformInfoDto::getRequestId).toList();
medicationRequestService.updateCompletedStatusBatch( List<MedicationRequest> allMedRequests = medicationRequestService.listByIds(medReqIds);
medRequestList.stream().map(PerformInfoDto::getRequestId).toList(), practitionerId, checkDate);
List<Long> stopMedIds = allMedRequests.stream()
.filter(mr -> RequestStatus.PENDING_STOP.getValue().equals(mr.getStatusEnum()))
.map(MedicationRequest::getId).toList();
List<Long> otherMedIds = allMedRequests.stream()
.filter(mr -> !RequestStatus.PENDING_STOP.getValue().equals(mr.getStatusEnum()))
.map(MedicationRequest::getId).toList();
// 停嘱待核对 → 停止STOPPED=6
if (!stopMedIds.isEmpty()) {
medicationRequestService.update(new LambdaUpdateWrapper<MedicationRequest>()
.in(MedicationRequest::getId, stopMedIds)
.set(MedicationRequest::getStatusEnum, RequestStatus.STOPPED.getValue())
.set(MedicationRequest::getPerformerCheckId, practitionerId)
.set(MedicationRequest::getCheckTime, checkDate));
}
// 其他类 → 已完成COMPLETED=3
if (!otherMedIds.isEmpty()) {
medicationRequestService.updateCompletedStatusBatch(otherMedIds, practitionerId, checkDate);
}
} }
if (!deviceRequestList.isEmpty()) { if (!deviceRequestList.isEmpty()) {
// 更新耗材请求状态已完成 List<Long> devReqIds = deviceRequestList.stream().map(PerformInfoDto::getRequestId).toList();
deviceRequestService.updateCompletedStatusBatch( // 同样处理耗材的停嘱核对
deviceRequestList.stream().map(PerformInfoDto::getRequestId).toList()); List<DeviceRequest> allDevRequests = deviceRequestService.listByIds(devReqIds);
List<Long> stopDevIds = allDevRequests.stream()
.filter(dr -> RequestStatus.PENDING_STOP.getValue().equals(dr.getStatusEnum()))
.map(DeviceRequest::getId).toList();
List<Long> otherDevIds = allDevRequests.stream()
.filter(dr -> !RequestStatus.PENDING_STOP.getValue().equals(dr.getStatusEnum()))
.map(DeviceRequest::getId).toList();
if (!stopDevIds.isEmpty()) {
deviceRequestService.update(new LambdaUpdateWrapper<DeviceRequest>()
.in(DeviceRequest::getId, stopDevIds)
.set(DeviceRequest::getStatusEnum, RequestStatus.STOPPED.getValue())
.set(DeviceRequest::getPerformerCheckId, practitionerId)
.set(DeviceRequest::getCheckTime, checkDate));
}
if (!otherDevIds.isEmpty()) {
deviceRequestService.updateCompletedStatusBatch(otherDevIds);
}
} }
return R.ok(null, "校对成功"); return R.ok(null, "校对成功");
} }

View File

@@ -88,6 +88,7 @@
v-loading="loading" v-loading="loading"
:data="filteredApplicationList" :data="filteredApplicationList"
:max-height="200" :max-height="200"
min-width="865"
border border
size="small" size="small"
:header-cell-style="{ background: '#f5f5f5', color: '#303133', fontWeight: '600' }" :header-cell-style="{ background: '#f5f5f5', color: '#303133', fontWeight: '600' }"
@@ -140,7 +141,7 @@
<vxe-column <vxe-column
title="收费" title="收费"
field="isCharged" field="isCharged"
width="50" width="65"
align="center" align="center"
> >
<template #default="{ row }"> <template #default="{ row }">
@@ -155,7 +156,7 @@
<vxe-column <vxe-column
title="退费" title="退费"
field="isRefunded" field="isRefunded"
width="50" width="65"
align="center" align="center"
> >
<template #default="{ row }"> <template #default="{ row }">
@@ -170,7 +171,7 @@
<vxe-column <vxe-column
title="执行" title="执行"
field="isExecuted" field="isExecuted"
width="50" width="65"
align="center" align="center"
> >
<template #default="{ row }"> <template #default="{ row }">
@@ -1451,7 +1452,10 @@ const availableMethods = computed(() => {
}); });
function isStandaloneMethodSelected(method) { function isStandaloneMethodSelected(method) {
return selectedMethods.value.some((m) => String(m.id) === String(method?.id)); return selectedMethods.value.some((m) =>
String(m.id) === String(method?.id) ||
(m.code && method?.code && String(m.code) === String(method.code))
);
} }
function getDisplayMethodName(method) { function getDisplayMethodName(method) {
@@ -1712,11 +1716,12 @@ watch(() => props.patientInfo, (newVal) => {
watch(() => props.activeTab, async (val) => { watch(() => props.activeTab, async (val) => {
if (val === 'examination') { if (val === 'examination') {
getList(); // 进入检查tab时自动初始化表单确保输入框可编辑且处于干净状态
// 切换到检查页签时,重新获取临床诊断(确保与诊断页签同步) // handleAdd 内部已调用 loadClinicalDiag() 获取临床诊断
if (props.patientInfo?.encounterId) { if (props.patientInfo?.encounterId) {
await loadClinicalDiag(); handleAdd();
} }
// 父组件 handleClick 中已调用 getList(),此处不再重复调用
} }
}); });
@@ -1859,7 +1864,8 @@ function handleSave() {
}); });
} }
function handleRowClick(row) { function handleRowClick({ row, column }) {
// vxe-table v4 cell-click 事件参数为 { row, column, rowIndex, ... },需解构获取实际行数据
Object.assign(form, row); Object.assign(form, row);
form.selectedMethodDisplay = ''; // Bug #384修复: 先清空,后面根据回充数据更新 form.selectedMethodDisplay = ''; // Bug #384修复: 先清空,后面根据回充数据更新
selectedItems.value = []; selectedItems.value = [];
@@ -1896,6 +1902,11 @@ function handleRowClick(row) {
packageId: null, packageId: null,
hasChildren: false // #426修复: 树形表格懒加载展开标记后续根据packageId动态设置 hasChildren: false // #426修复: 树形表格懒加载展开标记后续根据packageId动态设置
}; };
// Bug #656: 从已保存数据提取检查方法信息(移到 bodyPartCode 外部,确保始终可用)
const savedMethodCode = m.examMethodCode || m.checkMethodCode;
const savedMethodId = m.checkMethodId;
const savedMethodName = m.checkMethodName;
// 加载该项目的检查方法 // 加载该项目的检查方法
if (m.bodyPartCode) { if (m.bodyPartCode) {
try { try {
@@ -1916,49 +1927,74 @@ function handleRowClick(row) {
packagePrice: md.packagePrice || null, packagePrice: md.packagePrice || null,
serviceFee: md.serviceFee || null serviceFee: md.serviceFee || null
})); }));
// 回充已保存的检查方法
const methodCode = m.examMethodCode || m.checkMethodCode;
const methodId = m.checkMethodId;
if (methodCode || methodId) {
const found = item.methods.find(md =>
(methodCode && String(md.code) === String(methodCode)) ||
(methodId && String(md.id) === String(methodId))
);
if (found) {
item.selectedMethod = found;
} else {
item.selectedMethod = {
id: methodId || null,
name: m.checkMethodName || '',
code: methodCode || '',
price: 0,
packageName: m.checkMethodPackageName || '',
packageId: null,
packagePrice: null,
serviceFee: null
};
}
}
if (item.selectedMethod || item.packageId || item.packageName) {
item.hasChildren = true;
}
} }
} catch (err) { } catch (err) {
console.error('加载检查方法失败', err); console.error('加载检查方法失败', err);
} }
} }
// Bug #656修复: 回充已保存的检查方法(始终执行,不依赖 bodyPartCode 或 API 返回)
if (savedMethodCode || savedMethodId) {
let found = null;
// 1. 优先在该项目的检查方法列表中查找
found = item.methods.find(md =>
(savedMethodCode && String(md.code) === String(savedMethodCode)) ||
(savedMethodId && String(md.id) === String(savedMethodId))
);
// 2. 未找到时,回退到全局 allMethods 中查找(兼容 checkType 不匹配导致方法不在分类结果中的场景)
if (!found) {
found = allMethods.value.find(m =>
(savedMethodCode && String(m.code) === String(savedMethodCode)) ||
(savedMethodId && String(m.id) === String(savedMethodId))
);
}
// 3. 设置 selectedMethod
if (found) {
item.selectedMethod = {
id: found.id,
name: found.name,
code: found.code,
price: found.price || 0,
packageName: found.packageName || '',
packageId: found.packageId || null,
packagePrice: found.packagePrice || null,
serviceFee: found.serviceFee || null
};
} else {
// 4. 创建降级对象:优先用已保存名称,其次用代码作为显示名
item.selectedMethod = {
id: savedMethodId || null,
name: savedMethodName || savedMethodCode || '',
code: savedMethodCode || '',
price: 0,
packageName: m.checkMethodPackageName || '',
packageId: null,
packagePrice: null,
serviceFee: null
};
}
}
if (item.selectedMethod || item.packageId || item.packageName) {
item.hasChildren = true;
}
return item; return item;
})); }));
// Bug #408修复: 确保明细数据正确加载到selectedItems // Bug #656修复: 去重键改为 id || code避免 id 为 null 时误判为同一方法导致丢失
const methodMap = new Map(); const methodMap = new Map();
for (const item of itemsWithMethods) { for (const item of itemsWithMethods) {
if (item.selectedMethod && !methodMap.has(String(item.selectedMethod.id))) { if (item.selectedMethod) {
methodMap.set(String(item.selectedMethod.id), { const dedupKey = item.selectedMethod.id != null
...item.selectedMethod, ? String(item.selectedMethod.id)
expanded: false, : (item.selectedMethod.code || `__item_${item.id}`);
packageLoading: false, if (!methodMap.has(dedupKey)) {
packageDetails: [] methodMap.set(dedupKey, {
}); ...item.selectedMethod,
expanded: false,
packageLoading: false,
packageDetails: []
});
}
} }
item.methodPackageDetails = []; item.methodPackageDetails = [];
} }
@@ -1988,8 +2024,39 @@ function handleRowClick(row) {
syncCategoryChecked(); syncCategoryChecked();
// Bug #384修复: 回充后更新检查方法显示 // Bug #384修复: 回充后更新检查方法显示
updateMethodDisplay(); updateMethodDisplay();
// Bug #408修复: 加载申请单详情后自动切换到检查明细页签,确保已加载的明细数据可见
activeDetailTab.value = 'applyDetail'; // Bug #656修复: 展开对应检查项目分类节点,使树形结构和检查方法勾选状态正确回显
const firstItem = selectedItems.value[0];
if (firstItem && firstItem.checkType) {
const targetCat = categoryList.value.find(cat =>
(cat.typeName && cat.typeName === firstItem.checkType) ||
(cat.categoryName && cat.categoryName === firstItem.checkType)
);
if (targetCat) {
// 先确保分类树的方法已加载完成,再展开分类
// 注意顺序:先 await handleCategoryExpand再设置 activeNames
// 避免 handleCollapseChange 中异步加载与后续匹配逻辑的竞态条件
await handleCategoryExpand(targetCat);
activeNames.value = targetCat.typeId;
// 将 selectedMethods 中的降级方法id/name 为空)按 code 匹配分类树中的方法,补充名称和真实 ID
if (targetCat.methods && targetCat.methods.length > 0) {
let updated = false;
selectedMethods.value = selectedMethods.value.map(m => {
if ((!m.name || !m.id) && m.code) {
const matched = targetCat.methods.find(cm => String(cm.code) === String(m.code));
if (matched) {
updated = true;
return { ...matched, expanded: false, packageLoading: false, packageDetails: m.packageDetails || [] };
}
}
return m;
});
if (updated) {
updateMethodDisplay();
}
}
}
}
} catch (err) { } catch (err) {
console.error('加载申请单详情失败', err); console.error('加载申请单详情失败', err);
ElMessage.error('加载申请单详情失败'); ElMessage.error('加载申请单详情失败');
@@ -2333,10 +2400,11 @@ function resetCategoryChecked() {
function syncCategoryChecked() { function syncCategoryChecked() {
resetCategoryChecked(); resetCategoryChecked();
const ids = new Set(selectedItems.value.map(s => s.id)); // 统一转为 String 比较,避免 Number vs String 类型不匹配
const ids = new Set(selectedItems.value.map(s => String(s.id)));
for (const cat of categoryList.value) for (const cat of categoryList.value)
for (const item of cat.items) for (const item of cat.items)
if (ids.has(item.id)) item.checked = true; if (ids.has(String(item.id))) item.checked = true;
} }
defineExpose({ getList }); defineExpose({ getList });

View File

@@ -184,7 +184,7 @@ const handleDeleteRow = (row) => {
// 提交处理 // 提交处理
const handleSubmit = () => { const handleSubmit = () => {
const selectedRows = consumableTableRef.value.getSelectionRows(); const selectedRows = consumableTableRef.value.getCheckboxRecords();
// 保存到本地存储 // 保存到本地存储
localStorage.setItem('doctor' + userStore.id.toString(), dontShowAgain.value); localStorage.setItem('doctor' + userStore.id.toString(), dontShowAgain.value);
if (selectedRows.length === 0) { if (selectedRows.length === 0) {

View File

@@ -314,7 +314,7 @@
border border
@cell-click="clickRow" @cell-click="clickRow"
@cell-dblclick="clickRowDb" @cell-dblclick="clickRowDb"
@select="handleSelectionChange" @checkbox-change="handleSelectionChange"
> >
<vxe-column <vxe-column
type="expand" type="expand"
@@ -333,7 +333,7 @@
style="padding: 16px; background: #f8f9fa; border-radius: 8px" style="padding: 16px; background: #f8f9fa; border-radius: 8px"
> >
<template v-if="scope.row.adviceType == 1"> <template v-if="scope.row.adviceType == 1">
<div style="display: flex; align-items: center; margin-bottom: 16px; gap: 16px"> <div style="display: flex; align-items: center; margin-bottom: 16px; gap: 16px; flex-wrap: nowrap">
<span class="medicine-title"> <span class="medicine-title">
{{ {{
scope.row.adviceName + scope.row.adviceName +
@@ -411,9 +411,8 @@
}} }}
</span> </span>
</div> </div>
<div style="display: flex; align-items: center; gap: 12px; flex-wrap: wrap"> <div class="edit-form-row">
<div class="form-group"> <!-- 单次用量 -->
<!-- 单次剂量 -->
<el-form-item <el-form-item
label="单次用量:" label="单次用量:"
prop="doseQuantity" prop="doseQuantity"
@@ -426,7 +425,7 @@
:min="0" :min="0"
controls-position="right" controls-position="right"
:controls="false" :controls="false"
style="width: 70px; margin-right: 20px" style="width: 70px"
@input="convertValues(scope.row, scope.rowIndex)" @input="convertValues(scope.row, scope.rowIndex)"
@keyup.enter.prevent="handleEnter('doseQuantity', scope.row, scope.rowIndex)" @keyup.enter.prevent="handleEnter('doseQuantity', scope.row, scope.rowIndex)"
@change="calculateTotalAmount(scope.row, scope.rowIndex)" @change="calculateTotalAmount(scope.row, scope.rowIndex)"
@@ -435,7 +434,7 @@
<!-- 剂量单位 --> <!-- 剂量单位 -->
<el-select <el-select
v-model="scope.row.minUnitCode" v-model="scope.row.minUnitCode"
style="width: 70px; margin-right: 20px" style="width: 70px"
placeholder=" " placeholder=" "
> >
<template <template
@@ -461,7 +460,7 @@
v-model="scope.row.dose" v-model="scope.row.dose"
controls-position="right" controls-position="right"
:controls="false" :controls="false"
style="width: 70px; margin: 0 20px" style="width: 70px"
@input="convertDoseValues(scope.row, scope.rowIndex)" @input="convertDoseValues(scope.row, scope.rowIndex)"
@keyup.enter.prevent="handleEnter('dose', scope.row, scope.rowIndex)" @keyup.enter.prevent="handleEnter('dose', scope.row, scope.rowIndex)"
/> />
@@ -480,8 +479,6 @@
:label="item.label" :label="item.label"
/> />
</el-select> </el-select>
</div>
<div class="form-group">
<el-form-item <el-form-item
label="给药途径:" label="给药途径:"
prop="methodCode" prop="methodCode"
@@ -530,7 +527,6 @@
if (scope.row.rateCode) { if (scope.row.rateCode) {
handleEnter('rateCode', scope.row, scope.rowIndex); handleEnter('rateCode', scope.row, scope.rowIndex);
} }
// inputRefs.rateCode.blur();
} }
" "
@change="calculateTotalAmount(scope.row, scope.rowIndex)" @change="calculateTotalAmount(scope.row, scope.rowIndex)"
@@ -544,18 +540,8 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
</div>
</div> </div>
<div <div class="edit-form-row">
style="
display: flex;
align-items: center;
gap: 12px;
flex-wrap: wrap;
margin-top: 10px;
"
>
<div class="form-group">
<el-form-item <el-form-item
label="用药天数:" label="用药天数:"
prop="dispensePerDuration" prop="dispensePerDuration"
@@ -580,7 +566,6 @@
</template> </template>
</el-input-number> </el-input-number>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="总量:" label="总量:"
prop="quantity" prop="quantity"
@@ -600,7 +585,7 @@
<el-form-item> <el-form-item>
<el-select <el-select
v-model="scope.row.unitCode" v-model="scope.row.unitCode"
style="width: 70px; margin-right: 20px" style="width: 70px"
placeholder=" " placeholder=" "
@change="calculateTotalAmount(scope.row, scope.rowIndex)" @change="calculateTotalAmount(scope.row, scope.rowIndex)"
> >
@@ -633,50 +618,34 @@
</template> </template>
</el-select> </el-select>
</el-form-item> </el-form-item>
</div>
</div>
<div
style="
display: flex;
align-items: center;
gap: 12px;
flex-wrap: wrap;
margin-top: 10px;
"
>
<div class="form-group">
<el-form-item <el-form-item
label="备注:" label="备注:"
prop="remarks" prop="remarks"
style="margin: 0; margin-right: 20px"
> >
<el-input <el-input
v-model="scope.row.remarks" v-model="scope.row.remarks"
placeholder="请输入备注" placeholder="请输入备注"
maxlength="100" maxlength="100"
show-word-limit show-word-limit
style="width: 500px" style="width: 300px"
/> />
</el-form-item> </el-form-item>
</div>
<el-button <el-button
type="primary" type="primary"
@click="handleSaveSign(scope.row, scope.rowIndex)" @click="handleSaveSign(scope.row, scope.rowIndex)"
> >
确定 确定
</el-button> </el-button>
<el-button
@click="handleCancelEdit(scope.row, scope.rowIndex)"
>
取消
</el-button>
</div> </div>
</template> </template>
<!-- 🔧 Bug #147 修复耗材类型(adviceType=4)的编辑模板 --> <!-- 🔧 Bug #147 修复耗材类型(adviceType=4)的编辑模板 -->
<template v-else-if="scope.row.adviceType == 4"> <template v-else-if="scope.row.adviceType == 4">
<div <div class="edit-form-row">
style="
display: flex;
align-items: center;
margin-bottom: 16px;
gap: 16px;
"
>
<span class="medicine-title"> <span class="medicine-title">
{{ {{
scope.row.adviceName + scope.row.adviceName +
@@ -711,7 +680,7 @@
<el-form-item> <el-form-item>
<el-select <el-select
v-model="scope.row.unitCode" v-model="scope.row.unitCode"
style="width: 70px; margin-right: 20px" style="width: 70px"
placeholder=" " placeholder=" "
@change="calculateTotalAmount(scope.row, scope.rowIndex)" @change="calculateTotalAmount(scope.row, scope.rowIndex)"
> >
@@ -723,7 +692,6 @@
v-if="item.type != unitMap['dose']" v-if="item.type != unitMap['dose']"
:value="item.value" :value="item.value"
:label="item.label" :label="item.label"
style="width: 70px; margin-right: 20px"
@click=" @click="
() => { () => {
scope.row.unitCode_dictText = item.label; scope.row.unitCode_dictText = item.label;
@@ -750,23 +718,21 @@
: '0.00 元' : '0.00 元'
}} }}
</span> </span>
<el-button
type="primary"
@click="handleSaveSign(scope.row, scope.rowIndex)"
>
确定
</el-button>
<el-button
@click="handleCancelEdit(scope.row, scope.rowIndex)"
>
取消
</el-button>
</div> </div>
<el-button
type="primary"
@click="handleSaveSign(scope.row, scope.rowIndex)"
>
确定
</el-button>
</template> </template>
<template v-else-if="scope.row.adviceType == 2"> <template v-else-if="scope.row.adviceType == 2">
<div <div class="edit-form-row">
style="
display: flex;
align-items: center;
margin-bottom: 16px;
gap: 16px;
"
>
<span class="medicine-title"> <span class="medicine-title">
{{ {{
scope.row.adviceName + scope.row.adviceName +
@@ -801,7 +767,7 @@
<el-form-item> <el-form-item>
<el-select <el-select
v-model="scope.row.unitCode" v-model="scope.row.unitCode"
style="width: 70px; margin-right: 20px" style="width: 70px"
placeholder=" " placeholder=" "
@change="calculateTotalAmount(scope.row, scope.rowIndex)" @change="calculateTotalAmount(scope.row, scope.rowIndex)"
> >
@@ -813,7 +779,6 @@
v-if="item.type != unitMap['dose']" v-if="item.type != unitMap['dose']"
:value="item.value" :value="item.value"
:label="item.label" :label="item.label"
style="width: 70px; margin-right: 20px"
@click=" @click="
() => { () => {
scope.row.unitCode_dictText = item.label; scope.row.unitCode_dictText = item.label;
@@ -853,17 +818,22 @@
: '0.00 元' : '0.00 元'
}} }}
</span> </span>
<el-button
type="primary"
@click="handleSaveSign(scope.row, scope.rowIndex)"
>
确定
</el-button>
<el-button
@click="handleCancelEdit(scope.row, scope.rowIndex)"
>
取消
</el-button>
</div> </div>
<el-button
type="primary"
@click="handleSaveSign(scope.row, scope.rowIndex)"
>
确定
</el-button>
</template> </template>
<template v-else> <template v-else>
<div style="display: flex; align-items: center; margin-bottom: 16px; gap: 16px"> <div class="edit-form-row">
<span style="font-size: 16px; font-weight: 600"> <span style="font-size: 16px; font-weight: 600; white-space: nowrap">
{{ scope.row.adviceName }} {{ scope.row.adviceName }}
{{ {{
(scope.row.unitPrice !== undefined && scope.row.unitPrice !== null && !isNaN(scope.row.unitPrice) && (scope.row.unitPrice !== undefined && scope.row.unitPrice !== null && !isNaN(scope.row.unitPrice) &&
@@ -872,61 +842,63 @@
: '-' + '元' : '-' + '元'
}} }}
</span> </span>
<div class="form-group"> <el-form-item
<el-form-item label="执行次数:"
label="执行次数:" prop="quantity"
prop="quantity" class="required-field"
class="required-field" data-prop="quantity"
data-prop="quantity" >
> <el-input-number
<el-input-number :ref="(el) => (inputRefs.quantity = el)"
:ref="(el) => (inputRefs.quantity = el)" v-model="scope.row.quantity"
v-model="scope.row.quantity" placeholder="执行次数"
placeholder="执行次数" style="width: 100px"
style="width: 100px; margin: 0 20px" controls-position="right"
controls-position="right" :controls="false"
:controls="false" @keyup.enter.prevent="handleEnter('quantity', scope.row, scope.rowIndex)"
@keyup.enter.prevent="handleEnter('quantity', scope.row, scope.rowIndex)" @input="calculateTotalPrice(scope.row, scope.rowIndex)"
@input="calculateTotalPrice(scope.row, scope.rowIndex)" />
/> </el-form-item>
</el-form-item> <el-form-item
<el-form-item label="执行科室:"
label="执行科室:" prop="orgId"
prop="orgId" class="required-field"
class="required-field" data-prop="orgId"
data-prop="orgId" >
> <el-tree-select
<el-tree-select :ref="(el) => (inputRefs.orgId = el)"
:ref="(el) => (inputRefs.orgId = el)" v-model="scope.row.orgId"
v-model="scope.row.orgId" clearable
clearable style="width: 200px"
style="width: 200px" :data="organization"
:data="organization" :props="{ value: 'id', label: 'name', children: 'children' }"
:props="{ value: 'id', label: 'name', children: 'children' }" value-key="id"
value-key="id" check-strictly
check-strictly default-expand-all
default-expand-all placeholder="请选择执行科室"
placeholder="请选择执行科室" @change="(value) => handleOrgChange(value, scope.rowIndex, scope.row)"
@change="(value) => handleOrgChange(value, scope.rowIndex, scope.row)" />
/> </el-form-item>
</el-form-item> <span class="total-amount">
<span class="total-amount"> 总金额
总金额 {{
{{ (scope.row.totalPrice !== undefined && scope.row.totalPrice !== null &&
(scope.row.totalPrice !== undefined && scope.row.totalPrice !== null && !isNaN(scope.row.totalPrice) && isFinite(scope.row.totalPrice))
!isNaN(scope.row.totalPrice) && isFinite(scope.row.totalPrice)) ? Number(scope.row.totalPrice).toFixed(2) + ' 元'
? Number(scope.row.totalPrice).toFixed(2) + ' 元' : '0.00 元'
: '0.00 元' }}
}} </span>
</span>
<!-- 金额: {{ scope.row.priceList[0].price }} -->
</div>
<el-button <el-button
type="primary" type="primary"
@click="handleSaveSign(scope.row, scope.rowIndex)" @click="handleSaveSign(scope.row, scope.rowIndex)"
> >
确定 确定
</el-button> </el-button>
<el-button
@click="handleCancelEdit(scope.row, scope.rowIndex)"
>
取消
</el-button>
</div> </div>
</template> </template>
</div> </div>
@@ -1103,7 +1075,7 @@
</template> </template>
<div <div
v-else v-else
style="display: flex; align-items: center; gap: 8px;" style="display: flex; align-items: center; justify-content: center; gap: 8px;"
> >
<el-icon color="var(--el-color-primary)"> <el-icon color="var(--el-color-primary)">
<Memo /> <Memo />
@@ -1161,18 +1133,21 @@
title="单次剂量" title="单次剂量"
align="center" align="center"
field="" field=""
width="160"
> >
<template #default="scope"> <template #default="scope">
<template v-if="scope.row.isEdit"> <template v-if="scope.row.isEdit">
<el-input-number <div style="display: flex; align-items: center; white-space: nowrap;">
v-model="scope.row.dose" <el-input-number
:min="0" v-model="scope.row.dose"
:precision="2" :min="0"
:controls="false" :precision="2"
style="width: 70px" :controls="false"
size="small" style="width: 80px"
/> size="small"
<span style="margin-left: 4px">{{ scope.row.doseUnitCode_dictText }}</span> />
<span style="margin-left: 4px">{{ scope.row.doseUnitCode_dictText }}</span>
</div>
</template> </template>
<span v-else> <span v-else>
{{ {{
@@ -1191,20 +1166,23 @@
title="总量" title="总量"
align="center" align="center"
field="" field=""
width="140"
> >
<template #default="scope"> <template #default="scope">
<template v-if="scope.row.isEdit"> <template v-if="scope.row.isEdit">
<el-input-number <div style="display: flex; align-items: center; white-space: nowrap;">
v-model="scope.row.quantity" <el-input-number
:min="1" v-model="scope.row.quantity"
:precision="0" :min="1"
:controls="false" :precision="0"
style="width: 60px" :controls="false"
size="small" style="width: 70px"
@change="calculateTotalPrice(scope.row, scope.rowIndex)" size="small"
@input="calculateTotalPrice(scope.row, scope.rowIndex)" @change="calculateTotalPrice(scope.row, scope.rowIndex)"
/> @input="calculateTotalPrice(scope.row, scope.rowIndex)"
<span style="margin-left: 4px">{{ resolveTotalQuantityUnit(scope.row) }}</span> />
<span style="margin-left: 4px">{{ resolveTotalQuantityUnit(scope.row) }}</span>
</div>
</template> </template>
<span v-else> <span v-else>
{{ formatTotalQuantityWithUnit(scope.row) }} {{ formatTotalQuantityWithUnit(scope.row) }}
@@ -1216,7 +1194,7 @@
align="right" align="right"
field="" field=""
header-align="center" header-align="center"
width="100" width="120"
> >
<template #default="scope"> <template #default="scope">
<template v-if="scope.row.isEdit"> <template v-if="scope.row.isEdit">
@@ -1238,7 +1216,7 @@
title="药房/科室" title="药房/科室"
align="center" align="center"
field="" field=""
width="200" width="150"
> >
<template #default="scope"> <template #default="scope">
<template v-if="scope.row.isEdit"> <template v-if="scope.row.isEdit">
@@ -1576,6 +1554,19 @@ const orderGroupLoaded = ref({
const updateExpandOrder = (keys) => { const updateExpandOrder = (keys) => {
expandOrder.value = keys; expandOrder.value = keys;
}; };
// 收起所有展开行vxe-table v4: expandRowKeys只在初始化生效必须调实例方法收起行
function collapseAllExpanded() {
expandOrder.value = [];
if (prescriptionRef.value?.clearRowExpand) {
prescriptionRef.value.clearRowExpand();
} else if (prescriptionRef.value?.setRowExpand) {
const allRows = prescriptionRef.value.getData?.() || [];
if (allRows.length > 0) {
prescriptionRef.value.setRowExpand(allRows, false);
}
}
}
const stockList = ref([]); const stockList = ref([]);
const contractList = ref([]); const contractList = ref([]);
const conditionId = ref(''); const conditionId = ref('');
@@ -1764,7 +1755,7 @@ watch(
nextTick(() => { nextTick(() => {
const index = prescriptionList.value.findIndex((row) => row.uniqueKey === newValue[0]); const index = prescriptionList.value.findIndex((row) => row.uniqueKey === newValue[0]);
const items = proxy.$refs['formRef' + index]?.$el?.querySelectorAll('[data-prop]'); const items = proxy.$refs['formRef' + index]?.$el?.querySelectorAll('[data-prop]');
requiredProps.value = Array.from(items).map((item) => item.dataset.prop); requiredProps.value = items ? Array.from(items).map((item) => item.dataset.prop) : [];
}); });
} else { } else {
requiredProps.value = {}; requiredProps.value = {};
@@ -1876,7 +1867,7 @@ function handlePrintCommand(command) {
// 智能打印 - 根据选中数据的adviceType自动选择打印方式 // 智能打印 - 根据选中数据的adviceType自动选择打印方式
async function printPrescription() { async function printPrescription() {
// const selectedRows = prescriptionList.value.filter((item) => item.check); // const selectedRows = prescriptionList.value.filter((item) => item.check);
const selectedRows = prescriptionRef.value.getSelectionRows(); const selectedRows = prescriptionRef.value.getCheckboxRecords();
console.log('123456selectedRows', selectedRows); console.log('123456selectedRows', selectedRows);
if (selectedRows.length === 0) { if (selectedRows.length === 0) {
ElMessage.warning('未选择要打印的项目,请重新选择,打印失败'); ElMessage.warning('未选择要打印的项目,请重新选择,打印失败');
@@ -2003,7 +1994,7 @@ async function printPrescription() {
// 处方打印 - 专门打印处方类型的数据 // 处方打印 - 专门打印处方类型的数据
async function prescriptionPrint() { async function prescriptionPrint() {
// const selectedRows = prescriptionList.value.filter((item) => item.check); // const selectedRows = prescriptionList.value.filter((item) => item.check);
const selectedRows = prescriptionRef.value.getSelectionRows(); const selectedRows = prescriptionRef.value.getCheckboxRecords();
if (selectedRows.length === 0) { if (selectedRows.length === 0) {
ElMessage.warning('未选择要打印的项目,请重新选择,打印失败'); ElMessage.warning('未选择要打印的项目,请重新选择,打印失败');
return; return;
@@ -2086,7 +2077,7 @@ async function prescriptionPrint() {
async function disposalPrint() { async function disposalPrint() {
console.log('处置打印开始'); console.log('处置打印开始');
// const selectedRows = prescriptionList.value.filter((item) => item.check); // const selectedRows = prescriptionList.value.filter((item) => item.check);
const selectedRows = prescriptionRef.value.getSelectionRows(); const selectedRows = prescriptionRef.value.getCheckboxRecords();
if (selectedRows.length === 0) { if (selectedRows.length === 0) {
ElMessage.warning('未选择要打印的项目,请重新选择,打印失败'); ElMessage.warning('未选择要打印的项目,请重新选择,打印失败');
return; return;
@@ -2355,14 +2346,17 @@ function getDiagnosisInfo() {
} }
// 选择框改变时的处理 // 选择框改变时的处理
function handleSelectionChange(selection, row) { function handleSelectionChange({ checked, selection, row }) {
const isSelected = selection.some((item) => item.uniqueKey === row.uniqueKey); if (!row) return;
// 优先使用selection回退到checked兼容不同vxe-table版本
const isSelected = selection ? selection.some((item) => item.uniqueKey === row.uniqueKey) : !!checked;
if (!row.groupId) return;
prescriptionList.value prescriptionList.value
.filter((item) => { .filter((item) => {
return item.groupId && item.groupId == row?.groupId; return item.groupId && item.groupId == row.groupId && item.uniqueKey !== row.uniqueKey;
}) })
.forEach((row) => { .forEach((item) => {
prescriptionRef.value.toggleCheckboxRow(row, isSelected); prescriptionRef.value.toggleCheckboxRow(item, isSelected);
}); });
} }
@@ -2419,7 +2413,7 @@ function handleAddPrescription(prescriptionId, showWarning = true) {
}); });
getGroupMarkers(); getGroupMarkers();
nextTick(() => { nextTick(() => {
const adviceRefName = 'adviceRef_' + (prescriptionId || currentPrescriptionId.value) + '_0'; const adviceRefName = 'adviceRef' + 0;
const adviceRef = proxy.$refs[adviceRefName]; const adviceRef = proxy.$refs[adviceRefName];
if (adviceRef && adviceRef.focus) { if (adviceRef && adviceRef.focus) {
adviceRef.focus(); adviceRef.focus();
@@ -2519,7 +2513,11 @@ function handleFocus(row, index) {
function handleBlur(row) { function handleBlur(row) {
setTimeout(() => { setTimeout(() => {
row.showPopover = false; // 通过uniqueKey找到当前行确保popover关闭
const currentRow = prescriptionList.value.find(r => r.uniqueKey === row.uniqueKey);
if (currentRow) {
currentRow.showPopover = false;
}
}, 200); }, 200);
} }
@@ -2618,32 +2616,38 @@ function selectAdviceBase(key, row) {
async function setNewRow(key, row) { async function setNewRow(key, row) {
console.log('[BugFix] setNewRow - row.adviceType:', row.adviceType, 'row.adviceType_dictText:', row.adviceType_dictText, 'row.adviceTableName:', row.adviceTableName); console.log('[BugFix] setNewRow - row.adviceType:', row.adviceType, 'row.adviceType_dictText:', row.adviceType_dictText, 'row.adviceTableName:', row.adviceTableName);
// 每次选择药品时,将当前行数据完全重置,清空所有旧数据 // 不再替换行对象引用保持vxe-table的行引用不变确保插槽模板正确响应数据更新
const preservedData = { const currentRow = prescriptionList.value[rowIndex.value];
uniqueKey: prescriptionList.value[rowIndex.value].uniqueKey, if (!currentRow) return;
isEdit: true, // 保持编辑状态
statusEnum: 1, currentRow.isEdit = true;
showPopover: false, // 确保popover关闭 currentRow.statusEnum = 1;
}; // 立即设置adviceName确保输入框即时显示选中项名称
currentRow.adviceName = row.adviceName;
currentRow.showPopover = false;
// 完全替换整个对象,只保留必要的初始字段 await setValue(row);
prescriptionList.value[rowIndex.value] = preservedData;
setValue(row);
console.log('[BugFix] setNewRow after setValue - prescriptionList[rowIndex].adviceType:', prescriptionList.value[rowIndex.value].adviceType, 'adviceType_dictText:', prescriptionList.value[rowIndex.value].adviceType_dictText); console.log('[BugFix] setNewRow after setValue - prescriptionList[rowIndex].adviceType:', prescriptionList.value[rowIndex.value].adviceType, 'adviceType_dictText:', prescriptionList.value[rowIndex.value].adviceType_dictText);
// 🔧 Bug #220 修复确保在setValue之后重新计算耗材类型的总金额 // 🔧 Bug #220 修复确保在setValue之后重新计算耗材类型的总金额
// 耗材(adviceType=4)和诊疗(adviceType=3)需要重新计算以确保显示正确 // 耗材(adviceType=4)和诊疗(adviceType=3)需要重新计算以确保显示正确
const currentRow = prescriptionList.value[rowIndex.value]; if (currentRow.adviceType == 3 || currentRow.adviceType == 4) {
if (currentRow && (currentRow.adviceType == 3 || currentRow.adviceType == 4)) {
calculateTotalPrice(currentRow, rowIndex.value); calculateTotalPrice(currentRow, rowIndex.value);
} }
// 确保在setValue之后再次设置showPopover为false防止被覆盖 // 确保在setValue之后再次设置showPopover为false防止被覆盖
prescriptionList.value[rowIndex.value].showPopover = false; currentRow.showPopover = false;
expandOrder.value = [key]; expandOrder.value = [key];
// vxe-table v4: expandRowKeys只在初始化生效必须调实例方法展开行
await nextTick();
if (prescriptionRef.value?.setRowExpand) {
const rowObj = prescriptionList.value.find(item => item.uniqueKey === key);
if (rowObj) {
prescriptionRef.value.setRowExpand([rowObj], true);
}
}
// 自动聚焦到单次用量字段 - 使用 async/await 多次尝试 // 自动聚焦到单次用量字段 - 使用 async/await 多次尝试
await nextTick(); await nextTick();
@@ -2717,7 +2721,7 @@ function getInspectionApplyNoFromAdviceRow(row) {
} }
function handleDelete() { function handleDelete() {
let selectRows = prescriptionRef.value.getSelectionRows(); let selectRows = prescriptionRef.value.getCheckboxRecords();
console.log('BugFix#219: handleDelete called, selectRows=', selectRows); console.log('BugFix#219: handleDelete called, selectRows=', selectRows);
if (selectRows.length == 0) { if (selectRows.length == 0) {
@@ -2883,7 +2887,7 @@ function handleDelete() {
console.log('BugFix#219: 普通医嘱删除列表, deleteList=', deleteList.length, 'sum=', sum); console.log('BugFix#219: 普通医嘱删除列表, deleteList=', deleteList.length, 'sum=', sum);
handleEmrTreatment(); handleEmrTreatment();
updateExpandOrder([]); collapseAllExpanded();
isAdding.value = false; isAdding.value = false;
adviceQueryParams.value.adviceTypes = undefined; // 🎯 修复:改为 adviceTypes复数 adviceQueryParams.value.adviceTypes = undefined; // 🎯 修复:改为 adviceTypes复数
@@ -2998,11 +3002,11 @@ function handleSave(prescriptionId) {
if (prescriptionList.value[0]?.isEdit && !prescriptionList.value[0].adviceType) { if (prescriptionList.value[0]?.isEdit && !prescriptionList.value[0].adviceType) {
prescriptionList.value.shift(); prescriptionList.value.shift();
isAdding.value = false; isAdding.value = false;
updateExpandOrder([]); collapseAllExpanded();
} }
// --- 【修改点1优先获取选中行】 --- // --- 【修改点1优先获取选中行】 ---
const selectedRows = prescriptionRef.value ? prescriptionRef.value.getSelectionRows() : []; const selectedRows = prescriptionRef.value ? prescriptionRef.value.getCheckboxRecords() : [];
let sourceList = []; let sourceList = [];
// 如果用户有勾选,只处理勾选的;否则处理当前列表所有数据 // 如果用户有勾选,只处理勾选的;否则处理当前列表所有数据
@@ -3496,6 +3500,19 @@ function handleSkinTest(selectRows) {
); );
} }
// 取消编辑 - 关闭展开区域
function handleCancelEdit(row, index) {
if (isAdding.value && !row.requestId) {
// 新增行取消:移除该行
prescriptionList.value.splice(index, 1);
isAdding.value = false;
} else {
// 已有行取消:恢复非编辑状态
row.isEdit = false;
}
collapseAllExpanded();
}
// 单行处方保存 // 单行处方保存
function handleSaveSign(row, index, prescriptionId) { function handleSaveSign(row, index, prescriptionId) {
// 如果传入了处方ID先切换到该处方 // 如果传入了处方ID先切换到该处方
@@ -3580,7 +3597,7 @@ function handleSaveSign(row, index, prescriptionId) {
} }
row.isEdit = false; row.isEdit = false;
isAdding.value = false; isAdding.value = false;
updateExpandOrder([]); collapseAllExpanded();
row.contentJson = undefined; row.contentJson = undefined;
row.patientId = props.patientInfo.patientId; row.patientId = props.patientInfo.patientId;
row.encounterId = props.patientInfo.encounterId; row.encounterId = props.patientInfo.encounterId;
@@ -3751,7 +3768,7 @@ function handleSaveBatch(prescriptionId) {
// --- 【修改开始:优先使用选中行】 --- // --- 【修改开始:优先使用选中行】 ---
// 1. 获取表格当前选中的行 // 1. 获取表格当前选中的行
const selectedRows = prescriptionRef.value ? prescriptionRef.value.getSelectionRows() : []; const selectedRows = prescriptionRef.value ? prescriptionRef.value.getCheckboxRecords() : [];
// 2. 确定数据源 // 2. 确定数据源
// 逻辑:如果用户有勾选,就只处理勾选的;如果没勾选,就处理所有数据(一键保存) // 逻辑:如果用户有勾选,就只处理勾选的;如果没勾选,就处理所有数据(一键保存)
@@ -4051,22 +4068,34 @@ async function setValue(row) {
? (typeof row.skinTestFlag === 'number' ? row.skinTestFlag : (row.skinTestFlag ? 1 : 0)) ? (typeof row.skinTestFlag === 'number' ? row.skinTestFlag : (row.skinTestFlag ? 1 : 0))
: 0; : 0;
// 创建一个新的对象,而不是合并旧数据,以避免残留数据问题 // 不再替换行对象引用保持vxe-table的行引用不变确保插槽模板正确响应数据更新
console.log('[BugFix] setValue - row.adviceType:', row.adviceType, 'row.adviceType_dictText:', row.adviceType_dictText, 'row.adviceTableName:', row.adviceTableName); console.log('[BugFix] setValue - row.adviceType:', row.adviceType, 'row.adviceType_dictText:', row.adviceType_dictText, 'row.adviceTableName:', row.adviceTableName);
prescriptionList.value[rowIndex.value] = { const existingRow = prescriptionList.value[rowIndex.value];
...JSON.parse(JSON.stringify(row)), if (!existingRow) return;
// 确保adviceType为数字类型避免类型不匹配导致的显示问题
adviceType: Number(row.adviceType), // 保存需要保留的字段
// 🔧 Bug Fix: 确保adviceType_dictText被正确设置避免展开行时显示错误 const preservedKey = existingRow.uniqueKey;
adviceType_dictText: row.adviceType_dictText || mapAdviceTypeLabel(row.adviceType, row.adviceTableName), const preservedIsEdit = existingRow.isEdit;
skinTestFlag: skinTestFlag, // 确保皮试字段是数字类型 const preservedStatus = existingRow.statusEnum;
skinTestFlag_enumText: skinTestFlag == 1 ? '是' : '否', // 更新显示文本
// 保留原来设置的初始状态值 // 清除行上所有自有属性(避免残留旧数据)
uniqueKey: prescriptionList.value[rowIndex.value].uniqueKey, Object.keys(existingRow).forEach(key => {
isEdit: prescriptionList.value[rowIndex.value].isEdit, delete existingRow[key];
statusEnum: prescriptionList.value[rowIndex.value].statusEnum, });
showPopover: false, // 确保查询框关闭
}; // 从选中项复制所有属性到现有行对象
const rowData = JSON.parse(JSON.stringify(row));
Object.assign(existingRow, rowData);
// 覆盖需要特殊处理的字段
existingRow.adviceType = Number(row.adviceType);
existingRow.adviceType_dictText = row.adviceType_dictText || mapAdviceTypeLabel(row.adviceType, row.adviceTableName);
existingRow.skinTestFlag = skinTestFlag;
existingRow.skinTestFlag_enumText = skinTestFlag == 1 ? '是' : '否';
existingRow.uniqueKey = preservedKey;
existingRow.isEdit = preservedIsEdit;
existingRow.statusEnum = preservedStatus;
existingRow.showPopover = false;
console.log('[BugFix] setValue - prescriptionList[rowIndex].adviceType_dictText:', prescriptionList.value[rowIndex.value].adviceType_dictText); console.log('[BugFix] setValue - prescriptionList[rowIndex].adviceType_dictText:', prescriptionList.value[rowIndex.value].adviceType_dictText);
// 🔧 Bug #455: 诊疗医嘱(adviceType=3)的执行科室默认使用患者就诊科室, // 🔧 Bug #455: 诊疗医嘱(adviceType=3)的执行科室默认使用患者就诊科室,
// 不使用positionId(诊疗目录配置的执行科室)避免配置ID不在机构树中导致显示原始ID // 不使用positionId(诊疗目录配置的执行科室)避免配置ID不在机构树中导致显示原始ID
@@ -4489,7 +4518,7 @@ function escKeyListener(e) {
index = prescriptionList.value.findIndex((item) => item.uniqueKey == expandOrder.value[0]); index = prescriptionList.value.findIndex((item) => item.uniqueKey == expandOrder.value[0]);
} }
if (index == 0) { if (index == 0) {
updateExpandOrder([]); collapseAllExpanded();
} }
prescriptionList.value.shift(); prescriptionList.value.shift();
isAdding.value = false; isAdding.value = false;
@@ -4500,7 +4529,7 @@ function escKeyListener(e) {
// 签退/撤回 // 签退/撤回
function handleSingOut() { function handleSingOut() {
let selectRows = prescriptionRef.value.getSelectionRows(); let selectRows = prescriptionRef.value.getCheckboxRecords();
console.log('BugFix#219: handleSingOut called, selectRows=', selectRows); console.log('BugFix#219: handleSingOut called, selectRows=', selectRows);
console.log('BugFix#219: 选中行详情:', selectRows.map(item => ({ console.log('BugFix#219: 选中行详情:', selectRows.map(item => ({
adviceType: item.adviceType, adviceType: item.adviceType,
@@ -4686,7 +4715,7 @@ function handleGroupId(paramList) {
// 组合 // 组合
function combination() { function combination() {
let selectRows = prescriptionRef.value.getSelectionRows(); let selectRows = prescriptionRef.value.getCheckboxRecords();
if (selectRows.length <= 1) { if (selectRows.length <= 1) {
proxy.$modal.msgWarning('至少选择两项'); proxy.$modal.msgWarning('至少选择两项');
return; return;
@@ -4748,7 +4777,7 @@ function combination() {
// 拆组 // 拆组
function split() { function split() {
let selectRows = prescriptionRef.value.getSelectionRows(); let selectRows = prescriptionRef.value.getCheckboxRecords();
if (selectRows.length < 1) { if (selectRows.length < 1) {
proxy.$modal.msgWarning('至少选择一项'); proxy.$modal.msgWarning('至少选择一项');
return; return;
@@ -5342,8 +5371,8 @@ const orderSetDialogScope = ref('personal');
function openOrderSetDialog(scope) { function openOrderSetDialog(scope) {
orderSetDialogScope.value = scope || 'personal'; orderSetDialogScope.value = scope || 'personal';
const selectedRaw = const selectedRaw =
prescriptionRef.value && prescriptionRef.value.getSelectionRows prescriptionRef.value && prescriptionRef.value.getCheckboxRecords
? prescriptionRef.value.getSelectionRows() ? prescriptionRef.value.getCheckboxRecords()
: []; : [];
const selected = (selectedRaw || []).map((row) => { const selected = (selectedRaw || []).map((row) => {
@@ -5435,6 +5464,8 @@ defineExpose({ getListInfo, getDiagnosisInfo });
display: flex; display: flex;
align-items: center; align-items: center;
gap: 8px; gap: 8px;
flex-wrap: nowrap;
white-space: nowrap;
background: #fff; background: #fff;
padding: 6px 10px; padding: 6px 10px;
border-radius: 4px; border-radius: 4px;
@@ -5442,6 +5473,18 @@ defineExpose({ getListInfo, getDiagnosisInfo });
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
} }
.edit-form-row {
display: flex;
align-items: center;
gap: 12px;
flex-wrap: nowrap;
margin-top: 10px;
}
.edit-form-row .el-form-item {
margin-bottom: 0;
}
/* 调整element组件默认间距 */ /* 调整element组件默认间距 */
// .el-select, // .el-select,
// .el-input-number { // .el-input-number {

View File

@@ -1,6 +1,7 @@
<template> <template>
<el-dialog <el-dialog
v-model="props.open" :model-value="props.open"
@update:model-value="(val) => !val && emit('close')"
title="退费单" title="退费单"
width="1300px" width="1300px"
teleported teleported
@@ -221,7 +222,7 @@ function tableSpanMethod({ row, column, rowIndex }) {
function submit() { function submit() {
// 1. 获取当前选中行并提取去重的 paymentId 列表 // 1. 获取当前选中行并提取去重的 paymentId 列表
const selectedRows = proxy.$refs['refundListRef'].getSelectionRows(); const selectedRows = proxy.$refs['refundListRef'].getCheckboxRecords();
const selectedPaymentIds = [...new Set(selectedRows.map((row) => row.paymentId))]; const selectedPaymentIds = [...new Set(selectedRows.map((row) => row.paymentId))];
// 2. 遍历 refundList筛选出符合条件的数据并设置 refundFlag // 2. 遍历 refundList筛选出符合条件的数据并设置 refundFlag

View File

@@ -50,7 +50,7 @@
align="center" align="center"
width="120" width="120"
> >
<template #default="scope"> <template #default>
{{ '1' }} {{ '1' }}
</template> </template>
</vxe-column> </vxe-column>
@@ -166,7 +166,7 @@ const handleDeleteRow = (row) => {
// 提交处理 // 提交处理
const handleSubmit = () => { const handleSubmit = () => {
const selectedRows = consumableTableRef.value.getSelectionRows(); const selectedRows = consumableTableRef.value.getCheckboxRecords();
// 保存到本地存储 // 保存到本地存储
// localStorage.setItem('doctor' + userStore.id.toString(), dontShowAgain.value); // localStorage.setItem('doctor' + userStore.id.toString(), dontShowAgain.value);
if (selectedRows.length === 0) { if (selectedRows.length === 0) {

View File

@@ -227,7 +227,6 @@
<div style="padding: 10px; position: relative"> <div style="padding: 10px; position: relative">
<el-tabs <el-tabs
v-model="activeTab" v-model="activeTab"
v-loading="loading"
type="card" type="card"
style="width: 100%; height: 100%" style="width: 100%; height: 100%"
@tab-change="handleClick(activeTab)" @tab-change="handleClick(activeTab)"
@@ -546,7 +545,6 @@ const diagnosisRef = ref();
const consultationRef = ref(); const consultationRef = ref();
const infectiousReportRef = ref(); const infectiousReportRef = ref();
const waitCount = ref(0); const waitCount = ref(0);
const loading = ref(false);
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const visitType = ref(''); const visitType = ref('');
const firstVisitDate = ref(''); const firstVisitDate = ref('');
@@ -807,7 +805,6 @@ function handleCardClick(item, index) {
currentEncounterId.value = item.encounterId; currentEncounterId.value = item.encounterId;
console.log('currentEncounterId.value 设置为:', currentEncounterId.value); console.log('currentEncounterId.value 设置为:', currentEncounterId.value);
loading.value = true;
patientList.value.forEach((patient) => { patientList.value.forEach((patient) => {
patient.active = patient.encounterId === item.encounterId; patient.active = patient.encounterId === item.encounterId;
}); });
@@ -860,9 +857,6 @@ function handleCardClick(item, index) {
eprescriptionRef.value.getList(); eprescriptionRef.value.getList();
consultationRef.value.fetchConsultationList(); consultationRef.value.fetchConsultationList();
// emrRef.value.getDetail(item.encounterId); // emrRef.value.getDetail(item.encounterId);
setTimeout(() => {
loading.value = false;
}, 200);
}); });
} }

View File

@@ -259,9 +259,11 @@
<span v-else>{{ scope.row.adviceName }}</span> <span v-else>{{ scope.row.adviceName }}</span>
</template> </template>
</vxe-column> </vxe-column>
<vxe-column title="状态" align="center" field="" width="90"> <vxe-column title="状态" align="center" field="" width="120">
<template #default="scope"> <template #default="scope">
<el-tag v-if="scope.row.chargeStatus == 5" type="info"> <el-tag v-if="scope.row.statusEnum == 6" type="danger">停止</el-tag>
<el-tag v-else-if="scope.row.statusEnum == 13" type="warning">已停嘱(待核对)</el-tag>
<el-tag v-else-if="scope.row.chargeStatus == 5" type="info">
{{ scope.row.chargeStatus_enumText }} {{ scope.row.chargeStatus_enumText }}
</el-tag> </el-tag>
<el-tag v-else-if="scope.row.statusEnum == 2" type="success">已签发</el-tag> <el-tag v-else-if="scope.row.statusEnum == 2" type="success">已签发</el-tag>
@@ -272,7 +274,6 @@
<el-tag v-else-if="scope.row.statusEnum == 10" type="primary">已校对</el-tag> <el-tag v-else-if="scope.row.statusEnum == 10" type="primary">已校对</el-tag>
<el-tag v-else-if="scope.row.statusEnum == 11" type="primary">待接收</el-tag> <el-tag v-else-if="scope.row.statusEnum == 11" type="primary">待接收</el-tag>
<el-tag v-else-if="scope.row.statusEnum == 3" type="success">已校对</el-tag> <el-tag v-else-if="scope.row.statusEnum == 3" type="success">已校对</el-tag>
<el-tag v-else-if="scope.row.statusEnum == 6" type="danger">停止</el-tag>
<el-tag v-else-if="scope.row.statusEnum == 20" type="success">已完成</el-tag> <el-tag v-else-if="scope.row.statusEnum == 20" type="success">已完成</el-tag>
<el-tag v-else type="info">{{ scope.row.chargeStatus_enumText }}</el-tag> <el-tag v-else type="info">{{ scope.row.chargeStatus_enumText }}</el-tag>
</template> </template>
@@ -612,8 +613,9 @@ const adviceTypeList = computed(() => {
hasShownPharmacyConfigWarning.value = true; hasShownPharmacyConfigWarning.value = true;
} }
// 只返回不需要取药科室配置的类别(诊疗、手术、出院带药) // 只返回不需要取药科室配置的类别(诊疗、耗材、手术、出院带药)
return [ return [
{ label: '耗材', value: 2, adviceType: 2, categoryCode: '' },
{ label: '诊疗', value: 3, adviceType: 3, categoryCode: '' }, { label: '诊疗', value: 3, adviceType: 3, categoryCode: '' },
{ label: '手术', value: 6, adviceType: 6, categoryCode: '' }, { label: '手术', value: 6, adviceType: 6, categoryCode: '' },
{ label: '出院带药', value: 7, adviceType: 7, categoryCode: '' }, { label: '出院带药', value: 7, adviceType: 7, categoryCode: '' },
@@ -641,7 +643,8 @@ const adviceTypeList = computed(() => {
typeList.push({ label: '中草药', value: '1-4', adviceType: 1, categoryCode: '4' }); typeList.push({ label: '中草药', value: '1-4', adviceType: 1, categoryCode: '4' });
} }
// 始终添加诊疗和手术(它们不受取药配置限制) // 始终添加诊疗、耗材和手术(它们不受取药配置限制)
typeList.push({ label: '耗材', value: 2, adviceType: 2, categoryCode: '' });
typeList.push({ label: '诊疗', value: 3, adviceType: 3, categoryCode: '' }); typeList.push({ label: '诊疗', value: 3, adviceType: 3, categoryCode: '' });
typeList.push({ label: '手术', value: 6, adviceType: 6, categoryCode: '' }); typeList.push({ label: '手术', value: 6, adviceType: 6, categoryCode: '' });
@@ -666,6 +669,10 @@ const statusOption = [
label: '已签发', label: '已签发',
value: 2, value: 2,
}, },
{
label: '已停嘱',
value: 13,
},
{ {
label: '停止', label: '停止',
value: 6, value: 6,
@@ -963,6 +970,8 @@ function handleAddPrescription() {
statusEnum: 1, statusEnum: 1,
therapyEnum: '2', // 默认为临时医嘱 therapyEnum: '2', // 默认为临时医嘱
startTime: defaultStartTime, startTime: defaultStartTime,
requesterId_dictText: userStore.nickName,
requesterId: userStore.id,
}); });
getGroupMarkers(); getGroupMarkers();
nextTick(() => { nextTick(() => {
@@ -1221,6 +1230,8 @@ function selectAdviceBase(key, row) {
// Bug #589: 出院带药需要保留类型和标志setValue中可能被API数据覆盖 // Bug #589: 出院带药需要保留类型和标志setValue中可能被API数据覆盖
adviceType: prevRow.adviceType || undefined, adviceType: prevRow.adviceType || undefined,
dischargeFlag: prevRow.dischargeFlag || undefined, dischargeFlag: prevRow.dischargeFlag || undefined,
requesterId_dictText: userStore.nickName,
requesterId: userStore.id,
}; };
try { try {
setValue(row); setValue(row);
@@ -1714,6 +1725,8 @@ function handleSaveSign(row, index) {
} }
// 更新UI状态 // 更新UI状态
row.requesterId_dictText = userStore.nickName;
row.requesterId = userStore.id;
row.isEdit = false; row.isEdit = false;
isAdding.value = false; isAdding.value = false;
collapseAllExpanded(); collapseAllExpanded();
@@ -2075,6 +2088,8 @@ function handleSaveGroup(orderGroupList) {
// 创建新的处方项目 // 创建新的处方项目
const newRow = { const newRow = {
...prescriptionList.value[tempIndex], ...prescriptionList.value[tempIndex],
requesterId_dictText: userStore.nickName,
requesterId: userStore.id,
patientId: patientInfo.value.patientId, patientId: patientInfo.value.patientId,
encounterId: patientInfo.value.encounterId, encounterId: patientInfo.value.encounterId,
accountId: accountId.value, accountId: accountId.value,
@@ -2134,6 +2149,8 @@ function handleSaveGroup(orderGroupList) {
function handleSaveHistory(value) { function handleSaveHistory(value) {
let saveRow = { let saveRow = {
...value, ...value,
requesterId_dictText: userStore.nickName,
requesterId: userStore.id,
patientId: patientInfo.value.patientId, patientId: patientInfo.value.patientId,
encounterId: patientInfo.value.encounterId, encounterId: patientInfo.value.encounterId,
accountId: accountId.value, accountId: accountId.value,
@@ -2300,7 +2317,7 @@ function handleStopAdvice() {
// 找出停嘱的 // 找出停嘱的
for (let index = 0; index < selectRows.length; index++) { for (let index = 0; index < selectRows.length; index++) {
const item = selectRows[index]; const item = selectRows[index];
if (item.statusEnum == 6) { if (item.statusEnum == 6 || item.statusEnum == 13) {
isStop = false; isStop = false;
break; break;
} }

View File

@@ -202,7 +202,7 @@
<vxe-column <vxe-column
title="医嘱状态" title="医嘱状态"
field="requestStatus_enumText" field="requestStatus_enumText"
width="100" width="110"
align="center" align="center"
> >
<template #default="scope"> <template #default="scope">
@@ -372,6 +372,7 @@ const REQUEST_STATUS_DISPLAY = {
[RequestStatus.ACTIVE]: '已签发', [RequestStatus.ACTIVE]: '已签发',
[RequestStatus.COMPLETED]: '已校对', [RequestStatus.COMPLETED]: '已校对',
[RequestStatus.STOPPED]: '已停止', [RequestStatus.STOPPED]: '已停止',
[RequestStatus.PENDING_STOP]: '已停嘱',
}; };
/** 发药状态 → 医嘱状态映射表 */ /** 发药状态 → 医嘱状态映射表 */
@@ -395,17 +396,21 @@ const LEGACY_STATUS_TEXT = {
}; };
const getStatusDisplayText = (row) => { const getStatusDisplayText = (row) => {
// 1. 优先使用发药状态 // 1. 优先使用行级别请求状态:如果已停止或停嘱中,直接显示该状态
const requestCode = Number(row?.requestStatus);
if (requestCode === RequestStatus.STOPPED || requestCode === RequestStatus.PENDING_STOP) {
return REQUEST_STATUS_DISPLAY[requestCode];
}
// 2. 其次使用发药状态
const dispenseCode = Number(row?.dispenseStatus); const dispenseCode = Number(row?.dispenseStatus);
if (DISPENSE_STATUS_DISPLAY[dispenseCode]) { if (DISPENSE_STATUS_DISPLAY[dispenseCode]) {
return DISPENSE_STATUS_DISPLAY[dispenseCode]; return DISPENSE_STATUS_DISPLAY[dispenseCode];
} }
// 2. 使用行级别请求状态 // 3. 最后回退到其他请求状态
const requestCode = Number(row?.requestStatus);
if (REQUEST_STATUS_DISPLAY[requestCode]) { if (REQUEST_STATUS_DISPLAY[requestCode]) {
return REQUEST_STATUS_DISPLAY[requestCode]; return REQUEST_STATUS_DISPLAY[requestCode];
} }
// 3. 兼容旧后端枚举文本(如"已发送"→"已签发" // 4. 兼容旧后端枚举文本(如"已发送"→"已签发"
return LEGACY_STATUS_TEXT[row?.requestStatus_enumText] || row?.requestStatus_enumText || ''; return LEGACY_STATUS_TEXT[row?.requestStatus_enumText] || row?.requestStatus_enumText || '';
}; };