Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3310a1de9e | |||
| bbeddc3077 | |||
|
|
3f4ada958c | ||
| 377bd55c03 | |||
| 30526ee4fc | |||
| fa0cd2b41d | |||
| 1f7aed4a8e | |||
| 9f0e69177c | |||
|
|
e5b85c733d | ||
| 75970f07b1 | |||
| 103121d832 | |||
| c39f0175bb | |||
| 1767710754 | |||
| ca8b547062 | |||
| 7fa4871977 | |||
| a7b09a0248 |
@@ -25,3 +25,11 @@
|
||||
1. `initData()`: Add `formData.executeTime = formatDateTime(new Date())` after line 899
|
||||
2. `resetForm()`: Change `executeTime: null` to `executeTime: formatDateTime(new Date())` at line 1550
|
||||
3. `loadApplicationToForm()`: Fix `isPackage` logic at line 2000
|
||||
|
||||
修复结果:✅ 成功,5行改动
|
||||
|
||||
### 修改内容
|
||||
1. `initData()` (line ~898): 新增 `formData.executeTime = formatDateTime(new Date())` — 新增检验申请单时执行时间自动填充当前时间
|
||||
2. `resetForm()` (line ~1552): `executeTime: null` → `executeTime: formatDateTime(new Date())` — 重置表单/新增时执行时间默认当前时间
|
||||
3. `loadApplicationToForm()` (line ~2002): `isPackage` 判定从 `item.feePackageId != null || item.itemName?.includes('套餐')` 改为 `item.feePackageId != null && item.feePackageId !== '' && item.feePackageId !== 'null' && item.packageName` — 与 `loadCategoryItems()` 保持一致,只有真正的套餐项目才显示"套餐"标签
|
||||
|
||||
|
||||
36
bug556-analysis.md
Normal file
36
bug556-analysis.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# Bug #556 分析报告
|
||||
|
||||
## Bug 描述
|
||||
【门诊医生站-检验】新增检验申请单时就诊卡号/执行时间未自动回显,且项目列表冗余显示"套餐"文字
|
||||
|
||||
## 根因分析
|
||||
|
||||
### 问题1:就诊卡号字段为空
|
||||
**根因**:`formData.medicalrecordNumber` 绑定到前端"就诊卡号"字段,但数据来源映射错误。
|
||||
- `initData()` 第886行:`formData.medicalrecordNumber = props.patientInfo.identifierNo || ''`
|
||||
- `resetForm()` 第1526行:`medicalrecordNumber: props.patientInfo.identifierNo || ''`
|
||||
|
||||
`identifierNo` 是身份证号/标识号字段,通常为空。实际的就诊卡号/业务编号是 `props.patientInfo.busNo`。代码中 `formData.visitNo` 已经正确映射了 `busNo`,但 `medicalrecordNumber` 映射到了错误的字段。
|
||||
|
||||
### 问题2:执行时间未自动填充
|
||||
**根因**:`formData.executeTime` 初始值为 `null`(第978行),且 `initData()` 和 `resetForm()` 中均未赋予默认值。
|
||||
- 对比:`applyTime` 有 `startApplyTimeTimer()` 实时更新定时器(第1489行),但 `executeTime` 没有类似初始化。
|
||||
- 用户期望:新增申请单时执行时间应默认填充当前系统时间。
|
||||
|
||||
### 问题3:项目列表冗余显示"套餐"文字
|
||||
**根因**:`loadApplicationToForm()` 第2000行的 `isPackage` 判断条件过于宽松。
|
||||
- 第2000行:`const isPackage = item.feePackageId != null || item.itemName?.includes('套餐')`
|
||||
- 对比:`loadCategoryItems()` 第1190行已经做了正确修复:`item.feePackageId != null && ... && item.packageName`
|
||||
- 差异:第2000行只用 `feePackageId != null` 判断,缺少 `packageName` 联合判断。如果后端返回的非套餐项目 `feePackageId` 有值但 `packageName` 为空,仍会被误标为套餐。
|
||||
|
||||
## 修复方案
|
||||
|
||||
### 修复1:就诊卡号映射
|
||||
将 `medicalrecordNumber` 的数据源从 `props.patientInfo.identifierNo` 改为 `props.patientInfo.busNo`。
|
||||
涉及位置:`initData()` 第886行、`resetForm()` 第1526行
|
||||
|
||||
### 修复2:执行时间默认值
|
||||
在 `initData()` 和 `resetForm()` 中,将 `executeTime` 设置为当前时间。使用 `formatDateTime(new Date())` 格式化为 `YYYY-MM-DD HH:mm:ss`。
|
||||
|
||||
### 修复3:套餐标识判断
|
||||
将 `loadApplicationToForm()` 第2000行的 `isPackage` 判断条件与 `loadCategoryItems()` 第1190行保持一致,增加 `item.packageName` 联合判断。
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.core.framework.config;
|
||||
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
||||
@@ -34,7 +35,9 @@ public class ApplicationConfig {
|
||||
// 设置日期格式为 yyyy/M/d HH:mm:ss,支持多种格式反序列化
|
||||
builder.simpleDateFormat("yyyy/M/d HH:mm:ss");
|
||||
// 添加JavaTimeModule支持,用于LocalDateTime
|
||||
builder.modules(new JavaTimeModule());
|
||||
JavaTimeModule javaTimeModule = new JavaTimeModule();
|
||||
javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
builder.modules(javaTimeModule);
|
||||
builder.serializerByType(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy/M/d HH:mm:ss")));
|
||||
};
|
||||
}
|
||||
|
||||
@@ -169,11 +169,9 @@ public class OrganizationLocationAppServiceImpl implements IOrganizationLocation
|
||||
if (DateTimeUtils.isOverlap(organizationLocation.getStartTime(), organizationLocation.getEndTime(),
|
||||
orgLoc.getStartTime(), orgLoc.getEndTime())) {
|
||||
Organization org = organizationService.getById(organizationLocation.getOrganizationId());
|
||||
if (org == null) {
|
||||
continue;
|
||||
}
|
||||
String organizationName = org != null ? org.getName() : ("科室[" + organizationLocation.getOrganizationId() + "]已删除");
|
||||
return R.fail("当前诊疗:" + activityName + CommonConstants.Common.DASH + orgLoc.getStartTime()
|
||||
+ CommonConstants.Common.DASH + orgLoc.getEndTime() + "与" + org.getName() + "时间冲突");
|
||||
+ CommonConstants.Common.DASH + orgLoc.getEndTime() + "与" + organizationName + "时间冲突");
|
||||
}
|
||||
|
||||
if (orgLocQueryDto.getId() != null) {
|
||||
|
||||
@@ -215,6 +215,9 @@ public class SurgicalScheduleAppServiceImpl implements ISurgicalScheduleAppServi
|
||||
if (surgery != null) {
|
||||
surgery.setStatusEnum(1); // 1 = 已排期
|
||||
surgery.setUpdateTime(new Date());
|
||||
// Bug #558: 手术安排时同步写入手术室确认时间和确认人
|
||||
surgery.setOperatingRoomConfirmTime(new Date());
|
||||
surgery.setOperatingRoomConfirmUser(loginUser.getUsername());
|
||||
|
||||
// 填充缺失的申请科室和主刀医生名称
|
||||
fillSurgeryMissingNames(surgery);
|
||||
|
||||
@@ -147,6 +147,6 @@ public interface IDoctorStationAdviceAppService {
|
||||
*/
|
||||
IPage<SurgeryItemDto> getSurgeryPage(Long organizationId, Integer pageNo, Integer pageSize, String searchKey);
|
||||
|
||||
IPage<SurgeryItemDto> getExaminationPage(Long organizationId, Integer pageNo, Integer pageSize, String searchKey);
|
||||
IPage<SurgeryItemDto> getExaminationPage(Long organizationId, Integer pageNo, Integer pageSize, String searchKey, String categoryCode);
|
||||
|
||||
}
|
||||
|
||||
@@ -2566,12 +2566,13 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<SurgeryItemDto> getExaminationPage(Long organizationId, Integer pageNo, Integer pageSize, String searchKey) {
|
||||
public IPage<SurgeryItemDto> getExaminationPage(Long organizationId, Integer pageNo, Integer pageSize, String searchKey, String categoryCode) {
|
||||
IPage<SurgeryItemDto> result = doctorStationAdviceAppMapper.getExaminationPage(
|
||||
new Page<>(pageNo, pageSize),
|
||||
PublicationStatus.ACTIVE.getValue(),
|
||||
organizationId,
|
||||
searchKey);
|
||||
searchKey,
|
||||
categoryCode);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -226,8 +226,9 @@ public class DoctorStationAdviceController {
|
||||
@RequestParam(value = "organizationId", required = false) Long organizationId,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "500") Integer pageSize,
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey) {
|
||||
return R.ok(iDoctorStationAdviceAppService.getExaminationPage(organizationId, pageNo, pageSize, searchKey));
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "categoryCode", defaultValue = "23") String categoryCode) {
|
||||
return R.ok(iDoctorStationAdviceAppService.getExaminationPage(organizationId, pageNo, pageSize, searchKey, categoryCode));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -203,6 +203,7 @@ public interface DoctorStationAdviceAppMapper {
|
||||
IPage<SurgeryItemDto> getExaminationPage(@Param("page") Page<SurgeryItemDto> page,
|
||||
@Param("statusEnum") Integer statusEnum,
|
||||
@Param("organizationId") Long organizationId,
|
||||
@Param("searchKey") String searchKey);
|
||||
@Param("searchKey") String searchKey,
|
||||
@Param("categoryCode") String categoryCode);
|
||||
|
||||
}
|
||||
|
||||
@@ -133,47 +133,13 @@ public class PatientInformationServiceImpl implements IPatientInformationService
|
||||
@Override
|
||||
public IPage<PatientBaseInfoDto> getPatientInfo(PatientBaseInfoDto patientBaseInfoDto, String searchKey,
|
||||
Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
// 获取登录者信息
|
||||
// 构建基础查询条件
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
Long userId = loginUser.getUserId();
|
||||
Integer tenantId = loginUser.getTenantId().intValue();
|
||||
|
||||
// 先构建基础查询条件
|
||||
QueryWrapper<PatientBaseInfoDto> queryWrapper = HisQueryUtils.buildQueryWrapper(
|
||||
patientBaseInfoDto, searchKey, new HashSet<>(Arrays.asList(CommonConstants.FieldName.Name,
|
||||
CommonConstants.FieldName.BusNo, CommonConstants.FieldName.PyStr, CommonConstants.FieldName.WbStr)),
|
||||
request);
|
||||
|
||||
// 检查是否是精确ID查询(从门诊挂号页面跳转时使用)
|
||||
boolean hasExactIdQuery = (patientBaseInfoDto.getId() != null);
|
||||
|
||||
// 只有非精确ID查询时,才添加医生患者过滤条件
|
||||
if (!hasExactIdQuery) {
|
||||
// 查询当前用户对应的医生信息
|
||||
LambdaQueryWrapper<com.openhis.administration.domain.Practitioner> practitionerQuery = new LambdaQueryWrapper<>();
|
||||
practitionerQuery.eq(com.openhis.administration.domain.Practitioner::getUserId, userId);
|
||||
// 使用list()避免TooManyResultsException异常,然后取第一个记录
|
||||
List<com.openhis.administration.domain.Practitioner> practitionerList = practitionerService.list(practitionerQuery);
|
||||
com.openhis.administration.domain.Practitioner practitioner = practitionerList != null && !practitionerList.isEmpty() ? practitionerList.get(0) : null;
|
||||
|
||||
// 如果当前用户是医生,添加医生患者过滤条件
|
||||
if (practitioner != null) {
|
||||
// 查询该医生作为接诊医生(ADMITTER, code="1")和挂号医生(REGISTRATION_DOCTOR, code="12")的所有就诊记录的患者ID
|
||||
List<Long> doctorPatientIds = patientManageMapper.getPatientIdsByPractitionerId(
|
||||
practitioner.getId(),
|
||||
Arrays.asList(ParticipantType.ADMITTER.getCode(), ParticipantType.REGISTRATION_DOCTOR.getCode()),
|
||||
tenantId);
|
||||
|
||||
if (doctorPatientIds != null && !doctorPatientIds.isEmpty()) {
|
||||
// 添加患者ID过滤条件 - 注意:这里使用列名而不是表别名
|
||||
queryWrapper.in("id", doctorPatientIds);
|
||||
} else {
|
||||
// 如果没有相关患者,返回空结果
|
||||
queryWrapper.eq("id", -1); // 设置一个不存在的ID
|
||||
}
|
||||
}
|
||||
// 如果不是医生,查询所有患者
|
||||
}
|
||||
|
||||
IPage<PatientBaseInfoDto> patientInformationPage
|
||||
= patientManageMapper.getPatientPage(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
|
||||
@@ -897,7 +897,7 @@
|
||||
LIMIT #{limit} OFFSET #{offset}
|
||||
</select>
|
||||
|
||||
<!-- 检查项目专用分页查询:仅查检查(23) + 定价,无库存/草稿库存/取药科室等无关逻辑 -->
|
||||
<!-- 检查/检验项目专用分页查询:仅查指定 category_code + 定价,无库存/草稿库存/取药科室等无关逻辑 -->
|
||||
<select id="getExaminationPage" resultType="com.openhis.web.doctorstation.dto.SurgeryItemDto">
|
||||
SELECT DISTINCT ON (t1.ID)
|
||||
t1.ID AS advice_definition_id,
|
||||
@@ -919,7 +919,7 @@
|
||||
ON t3.id = t1.org_id
|
||||
AND t3.delete_flag = '0'
|
||||
WHERE t1.delete_flag = '0'
|
||||
AND t1.category_code = '23'
|
||||
AND t1.category_code = #{categoryCode}
|
||||
<if test="searchKey != null and searchKey != ''">
|
||||
AND (t1.name ILIKE '%' || #{searchKey} || '%' OR t1.py_str ILIKE '%' || #{searchKey} || '%')
|
||||
</if>
|
||||
|
||||
@@ -220,3 +220,18 @@ export function getSlotStatusDescription(value) {
|
||||
export function getSlotStatusClass(status) {
|
||||
return SlotStatusClassMap[status] || 'status-unbooked';
|
||||
}
|
||||
|
||||
/**
|
||||
* 诊疗项目分类代码(对应后端 ActivityDefCategory 枚举)
|
||||
* wor_activity_definition.category_code 字段
|
||||
*/
|
||||
export const ActivityCategory = {
|
||||
/** 治疗 */
|
||||
TREATMENT: '21',
|
||||
/** 检验 */
|
||||
PROOF: '22',
|
||||
/** 检查 */
|
||||
TEST: '23',
|
||||
/** 手术 */
|
||||
PROCEDURE: '24',
|
||||
};
|
||||
|
||||
@@ -883,7 +883,7 @@ const initData = async () => {
|
||||
formData.visitNo = props.patientInfo.busNo || ''
|
||||
formData.patientId = props.patientInfo.patientId || ''
|
||||
formData.patientName = props.patientInfo.patientName || ''
|
||||
formData.medicalrecordNumber = props.patientInfo.identifierNo || ''
|
||||
formData.medicalrecordNumber = props.patientInfo.visitNo || props.patientInfo.busNo || ''
|
||||
formData.applyDepartment = props.patientInfo.organizationName || ''
|
||||
formData.applyDocName = userNickName.value || userName.value || ''
|
||||
formData.applyDocCode = userId.value || ''
|
||||
@@ -895,9 +895,14 @@ const initData = async () => {
|
||||
|
||||
// 申请单号在保存时由后端生成,此处显示"自动生成"
|
||||
formData.applyNo = '自动生成'
|
||||
// 执行时间默认填充当前系统时间
|
||||
formData.executeTime = formatDateTime(new Date())
|
||||
// 申请日期实时更新(启动定时器)
|
||||
startApplyTimeTimer()
|
||||
|
||||
// 执行时间默认填充当前系统时间
|
||||
formData.executeTime = formatDateTime(new Date())
|
||||
|
||||
// 获取主诊断信息
|
||||
try {
|
||||
const res = await getEncounterDiagnosis(props.patientInfo.encounterId)
|
||||
@@ -1523,7 +1528,7 @@ const resetForm = async () => {
|
||||
applicationId: null,
|
||||
applyOrganizationId: props.patientInfo.orgId || '',
|
||||
patientName: props.patientInfo.patientName || '',
|
||||
medicalrecordNumber: props.patientInfo.identifierNo || '',
|
||||
medicalrecordNumber: props.patientInfo.visitNo || props.patientInfo.busNo || '',
|
||||
natureofCost: 'self',
|
||||
applyTime: '', // 申请日期由定时器实时更新
|
||||
applyDepartment: props.patientInfo.organizationName || '',
|
||||
@@ -1547,7 +1552,7 @@ const resetForm = async () => {
|
||||
visitNo: '',
|
||||
specimenName: '血液',
|
||||
encounterId: props.patientInfo.encounterId || '',
|
||||
executeTime: null,
|
||||
executeTime: formatDateTime(new Date()),
|
||||
applicationType: 0,
|
||||
})
|
||||
selectedInspectionItems.value = []
|
||||
@@ -1597,7 +1602,7 @@ const handleSave = () => {
|
||||
// 修复【#406】:保存前尝试从 props 同步患者信息,避免因加载时序导致信息缺失
|
||||
if ((!formData.patientName?.trim() || !formData.medicalrecordNumber?.trim()) && props.patientInfo && props.patientInfo.encounterId) {
|
||||
formData.patientName = props.patientInfo.patientName || ''
|
||||
formData.medicalrecordNumber = props.patientInfo.identifierNo || ''
|
||||
formData.medicalrecordNumber = props.patientInfo.visitNo || props.patientInfo.busNo || ''
|
||||
formData.encounterId = props.patientInfo.encounterId || ''
|
||||
formData.visitNo = props.patientInfo.busNo || ''
|
||||
formData.patientId = props.patientInfo.patientId || ''
|
||||
@@ -1997,7 +2002,7 @@ const loadApplicationToForm = async (row) => {
|
||||
// Bug #387修复: 套餐项目默认展开,并自动加载明细
|
||||
selectedInspectionItems.value = detail.labApplyItemList.map(item => {
|
||||
const itemId = item.activityId || item.itemId || item.id || Math.random().toString(36).substring(2, 11)
|
||||
const isPackage = item.feePackageId != null || item.itemName?.includes('套餐')
|
||||
const isPackage = item.feePackageId != null && item.feePackageId !== '' && item.feePackageId !== 'null' && item.packageName
|
||||
|
||||
return {
|
||||
itemId: itemId,
|
||||
|
||||
@@ -17,17 +17,14 @@
|
||||
style="width: 300px; margin-bottom: 10px"
|
||||
>
|
||||
<template #append>
|
||||
<el-button @click="handleSearch">搜索</el-button>
|
||||
<el-button @click="handleSearch" :loading="loading">搜索</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
<span v-if="!searchKey" class="total-count">共 {{ totalCount }} 项</span>
|
||||
<span v-else class="total-count">搜索到 {{ filteredCount }} 项 / 共 {{ totalCount }} 项</span>
|
||||
<span class="total-count">共 {{ totalCount }} 项</span>
|
||||
</div>
|
||||
<el-transfer
|
||||
v-model="transferValue"
|
||||
:data="transferData"
|
||||
filter-placeholder="项目代码/名称"
|
||||
filterable
|
||||
:titles="['未选择', '已选择']"
|
||||
/>
|
||||
</div>
|
||||
@@ -136,7 +133,8 @@
|
||||
<script setup name="LaboratoryTests">
|
||||
import {getCurrentInstance, nextTick, onMounted, reactive, ref, watch, computed} from 'vue';
|
||||
import {patientInfo} from '../../../store/patient.js';
|
||||
import {getApplicationList, saveInspection} from './api';
|
||||
import {getExaminationPage, saveInspection} from './api';
|
||||
import {ActivityCategory} from '@/utils/medicalConstants';
|
||||
import {getDepartmentList} from '@/api/public.js';
|
||||
import {getEncounterDiagnosis} from '../../api.js';
|
||||
import {ElMessage} from 'element-plus';
|
||||
@@ -173,9 +171,8 @@ const skipDeptAutoFill = ref(false);
|
||||
// 将已加载的全部数据转为 transfer 组件所需的格式
|
||||
const buildTransferData = (records) => {
|
||||
return records.map((item) => {
|
||||
const priceInfo = item.priceList?.[0] || {};
|
||||
const price = priceInfo.price != null ? Number(priceInfo.price).toFixed(2) : '0.00';
|
||||
const unit = item.unitCode_dictText || item.unitCode || '';
|
||||
const price = item.price != null ? Number(item.price).toFixed(2) : '0.00';
|
||||
const unit = item.unitCodeDictText || item.unitCode || '';
|
||||
return {
|
||||
adviceDefinitionId: item.adviceDefinitionId,
|
||||
orgId: item.orgId,
|
||||
@@ -185,7 +182,8 @@ const buildTransferData = (records) => {
|
||||
});
|
||||
};
|
||||
|
||||
// 加载全部数据(不分页,一次性拉取)
|
||||
const selectedItemsCache = ref(new Map());
|
||||
|
||||
const loadAllData = async () => {
|
||||
if (!patientInfo.value?.inHospitalOrgId) {
|
||||
applicationListAll.value = [];
|
||||
@@ -193,13 +191,12 @@ const loadAllData = async () => {
|
||||
}
|
||||
loading.value = true;
|
||||
try {
|
||||
// 使用大 pageSize 一次性拉取所有启用状态的检验类诊疗项目
|
||||
const res = await getApplicationList({
|
||||
pageSize: 9999,
|
||||
const res = await getExaminationPage({
|
||||
pageSize: 100,
|
||||
pageNo: 1,
|
||||
categoryCode: '22',
|
||||
categoryCode: ActivityCategory.PROOF,
|
||||
organizationId: patientInfo.value.inHospitalOrgId,
|
||||
adviceTypes: [3], // 1 药品 2 耗材 3 诊疗
|
||||
searchKey: searchKey.value,
|
||||
});
|
||||
if (res.code !== 200) {
|
||||
proxy.$message.error(res.message);
|
||||
@@ -208,8 +205,9 @@ const loadAllData = async () => {
|
||||
}
|
||||
applicationListAll.value = res.data?.records || [];
|
||||
totalCount.value = res.data?.total || 0;
|
||||
// 检验项目列表为异步加载,编辑回显必须在数据就绪后执行,否则已选区一直为空
|
||||
applyEditTransferSelection()
|
||||
if (!searchKey.value) {
|
||||
applyEditTransferSelection();
|
||||
}
|
||||
} catch (e) {
|
||||
proxy.$message.error('获取检验项目列表失败');
|
||||
applicationListAll.value = [];
|
||||
@@ -218,32 +216,18 @@ const loadAllData = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
// 根据搜索关键词过滤数据
|
||||
const filterData = (key) => {
|
||||
if (!key || key.trim() === '') {
|
||||
return applicationListAll.value;
|
||||
}
|
||||
const lowerKey = key.toLowerCase().trim();
|
||||
return applicationListAll.value.filter((item) => {
|
||||
return (
|
||||
item.adviceName?.toLowerCase().includes(lowerKey) ||
|
||||
item.pyStr?.toLowerCase().includes(lowerKey) ||
|
||||
item.adviceBusNo?.toLowerCase().includes(lowerKey)
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
// transfer 组件实际显示的数据(受搜索词影响)
|
||||
const transferData = computed(() => buildTransferData(filterData(searchKey.value)));
|
||||
// 当前显示的条数
|
||||
const filteredCount = computed(() => filterData(searchKey.value).length);
|
||||
const transferData = computed(() => buildTransferData(applicationListAll.value));
|
||||
|
||||
const getList = async () => {
|
||||
await loadAllData();
|
||||
};
|
||||
|
||||
let searchTimer = null;
|
||||
const handleSearch = () => {
|
||||
// 搜索时保持已选中的项目不受影响
|
||||
clearTimeout(searchTimer);
|
||||
searchTimer = setTimeout(() => {
|
||||
loadAllData();
|
||||
}, 300);
|
||||
};
|
||||
// 编辑初始化标志:避免 applyEditTransferSelection 设置 transferValue 时触发 projectWithDepartment 覆盖 descJson 中的科室值
|
||||
const isInitializing = ref(false);
|
||||
@@ -302,13 +286,17 @@ const projectWithDepartment = (selectProjectIds, type) => {
|
||||
const arr = [];
|
||||
// 根据选中的项目id查找对应的项目(从全部原始数据中查找)
|
||||
selectProjectIds.forEach((element) => {
|
||||
const searchData = applicationListAll.value.find((item) => {
|
||||
let searchData = applicationListAll.value.find((item) => {
|
||||
return element == item.adviceDefinitionId;
|
||||
});
|
||||
if (!searchData) {
|
||||
searchData = selectedItemsCache.value.get(element);
|
||||
}
|
||||
if (searchData) {
|
||||
const priceInfo = searchData.priceList?.[0] || {};
|
||||
const price = priceInfo.price != null ? Number(priceInfo.price).toFixed(2) : '0.00';
|
||||
const unit = searchData.unitCode_dictText || searchData.unitCode || '';
|
||||
const price = searchData.price != null ? Number(searchData.price).toFixed(2)
|
||||
: priceInfo.price != null ? Number(priceInfo.price).toFixed(2) : '0.00';
|
||||
const unit = searchData.unitCodeDictText || searchData.unitCode_dictText || searchData.unitCode || '';
|
||||
arr.push({
|
||||
adviceDefinitionId: searchData.adviceDefinitionId,
|
||||
orgId: searchData.orgId,
|
||||
@@ -371,6 +359,12 @@ watch(
|
||||
(newValue) => {
|
||||
if (skipDeptAutoFill.value) return;
|
||||
if (isInitializing.value) return;
|
||||
newValue.forEach((id) => {
|
||||
if (!selectedItemsCache.value.has(id)) {
|
||||
const item = applicationListAll.value.find((i) => i.adviceDefinitionId == id);
|
||||
if (item) selectedItemsCache.value.set(id, item);
|
||||
}
|
||||
});
|
||||
projectWithDepartment(newValue, 1);
|
||||
}
|
||||
);
|
||||
@@ -455,13 +449,14 @@ watch(
|
||||
}
|
||||
)
|
||||
|
||||
// 编辑模式下,项目字典加载完成后重新回显已选项目
|
||||
// 编辑模式下,项目字典首次加载完成后回显已选项目(搜索刷新不重置)
|
||||
watch(
|
||||
() => applicationListAll.value,
|
||||
() => {
|
||||
if (!props.editData?.requestFormId) return;
|
||||
if (!props.editData.requestFormDetailList?.length) return;
|
||||
if (!applicationListAll.value.length) return;
|
||||
if (searchKey.value) return;
|
||||
|
||||
const selectedIds = [];
|
||||
props.editData.requestFormDetailList.forEach((detail) => {
|
||||
@@ -486,26 +481,29 @@ const submit = () => {
|
||||
if (!projectWithDepartment(transferValue.value, 2)) {
|
||||
return;
|
||||
}
|
||||
let applicationListAllFilter = applicationListAll.value.filter((item) => {
|
||||
return transferValue.value.includes(item.adviceDefinitionId);
|
||||
});
|
||||
applicationListAllFilter = applicationListAllFilter.map((item) => {
|
||||
let applicationListAllFilter = transferValue.value.map((id) => {
|
||||
let item = applicationListAll.value.find((i) => i.adviceDefinitionId == id);
|
||||
if (!item) {
|
||||
item = selectedItemsCache.value.get(id);
|
||||
}
|
||||
if (!item) return null;
|
||||
const priceInfo = item.priceList?.[0] || {};
|
||||
return {
|
||||
adviceDefinitionId: item.adviceDefinitionId /** 诊疗定义id */,
|
||||
quantity: 1, // /** 请求数量 */
|
||||
unitCode: item.priceList[0].unitCode /** 请求单位编码 */,
|
||||
unitPrice: item.priceList[0].price /** 单价 */,
|
||||
totalPrice: item.priceList[0].price /** 总价 */,
|
||||
unitCode: item.unitCode || priceInfo.unitCode || '' /** 请求单位编码 */,
|
||||
unitPrice: item.price ?? priceInfo.price ?? 0 /** 单价 */,
|
||||
totalPrice: item.price ?? priceInfo.price ?? 0 /** 总价 */,
|
||||
positionId: form.targetDepartment || item.positionId, // 用户指定发往科室优先于项目默认执行科室
|
||||
ybClassEnum: item.ybClassEnum, //类别医保编码
|
||||
conditionId: item.conditionId, //诊断ID
|
||||
encounterDiagnosisId: item.encounterDiagnosisId, //就诊诊断id
|
||||
adviceType: item.adviceType, ///** 医嘱类型 */
|
||||
definitionId: item.priceList[0].definitionId, //费用定价主表ID */
|
||||
definitionDetailId: item.definitionDetailId, //费用定价子表ID */
|
||||
ybClassEnum: item.ybClassEnum || '', //类别医保编码
|
||||
conditionId: item.conditionId || '', //诊断ID
|
||||
encounterDiagnosisId: item.encounterDiagnosisId || '', //就诊诊断id
|
||||
adviceType: item.adviceType || 3, ///** 医嘱类型 */
|
||||
definitionId: item.chargeItemDefinitionId || priceInfo.definitionId || '', //费用定价主表ID */
|
||||
definitionDetailId: item.definitionDetailId || priceInfo.definitionDetailId || '', //费用定价子表ID */
|
||||
accountId: patientInfo.value.accountId, // // 账户id
|
||||
};
|
||||
});
|
||||
}).filter(Boolean);
|
||||
const params = {
|
||||
activityList: applicationListAllFilter,
|
||||
patientId: patientInfo.value.patientId, //患者ID
|
||||
@@ -520,6 +518,7 @@ const submit = () => {
|
||||
if (res.code === 200) {
|
||||
proxy.$message.success(isEditMode.value ? '修改成功' : res.msg);
|
||||
transferValue.value = [];
|
||||
selectedItemsCache.value.clear();
|
||||
emits('submitOk');
|
||||
} else {
|
||||
proxy.$message.error(res.message);
|
||||
|
||||
@@ -207,6 +207,7 @@ import {patientInfo} from '../../../store/patient.js';
|
||||
import {getDepartmentList} from '@/api/public.js';
|
||||
import {getEncounterDiagnosis} from '../../api.js';
|
||||
import {getExaminationPage, saveCheckd} from './api';
|
||||
import {ActivityCategory} from '@/utils/medicalConstants';
|
||||
import {ElMessage, ElMessageBox} from 'element-plus';
|
||||
import {WarningFilled, Warning, Refresh, Files, Document, EditPen, Aim, DocumentCopy} from '@element-plus/icons-vue';
|
||||
|
||||
@@ -276,6 +277,7 @@ const getList = () => {
|
||||
pageNo: 1,
|
||||
pageSize: 5000,
|
||||
searchKey: '',
|
||||
categoryCode: ActivityCategory.TEST,
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code === 200 && res.data?.records) {
|
||||
|
||||
@@ -198,7 +198,7 @@
|
||||
v-model="scope.row.adviceName"
|
||||
placeholder="请选择项目"
|
||||
@input="handleChange"
|
||||
@click="handleFocus(scope.row, scope.$index)"
|
||||
@focus="handleFocus(scope.row, scope.$index)"
|
||||
@keyup.enter.stop="handleFocus(scope.row, scope.$index)"
|
||||
@keydown="
|
||||
(e) => {
|
||||
@@ -640,6 +640,10 @@ function getListInfo(addNewRow) {
|
||||
};
|
||||
})
|
||||
.sort((a, b) => {
|
||||
// 没有 requestTime 的项(新增/组套添加)排在最前面
|
||||
if (!a.requestTime && !b.requestTime) return 0;
|
||||
if (!a.requestTime) return -1;
|
||||
if (!b.requestTime) return 1;
|
||||
return new Date(b.requestTime) - new Date(a.requestTime);
|
||||
});
|
||||
getGroupMarkers(); // 更新标记
|
||||
@@ -896,31 +900,16 @@ function handleDiagnosisChange(item) {
|
||||
function handleFocus(row, index) {
|
||||
rowIndex.value = index;
|
||||
row.showPopover = true;
|
||||
// Bug #555: handleFocus 只负责开 popover 和初始化查询参数,搜索由 handleChange 统一处理
|
||||
// 避免异步 refresh 用旧闭包 searchKey 覆盖 handleChange 的搜索结果
|
||||
const adviceType = row.adviceType !== undefined ? row.adviceType : adviceQueryParams.value.adviceType;
|
||||
// 用 adviceType + categoryCode 组合查找匹配的选项
|
||||
let categoryCode = '';
|
||||
if (row.adviceType !== undefined) {
|
||||
const selectValue = (adviceType == 1 && row.categoryCode) ? '1-' + row.categoryCode : adviceType;
|
||||
const selectedItem = adviceTypeList.value.find(item => item.value === selectValue) || adviceTypeList.value.find(item => item.adviceType === adviceType);
|
||||
// If the row has an explicit adviceType (saved/existing row), use its own categoryCode.
|
||||
// If no type is selected (new row), use empty string for global search across all categories.
|
||||
const categoryCode = selectedItem ? selectedItem.categoryCode : (row.adviceType != null ? (row.categoryCode || '') : '');
|
||||
const searchKey = row.adviceName || '';
|
||||
|
||||
nextTick(() => {
|
||||
nextTick(() => {
|
||||
const tableRef = Array.isArray(adviceTableRef.value) ? adviceTableRef.value[index] : adviceTableRef.value;
|
||||
if (tableRef && tableRef.refresh) {
|
||||
tableRef.refresh(adviceType, categoryCode, searchKey);
|
||||
} else {
|
||||
// fallback: 如果双重 nextTick 仍未挂载,延迟 100ms 再试
|
||||
setTimeout(() => {
|
||||
const tableRef2 = Array.isArray(adviceTableRef.value) ? adviceTableRef.value[index] : adviceTableRef.value;
|
||||
if (tableRef2 && tableRef2.refresh) {
|
||||
tableRef2.refresh(adviceType, categoryCode, searchKey);
|
||||
categoryCode = selectedItem ? selectedItem.categoryCode : (row.categoryCode || '');
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
});
|
||||
adviceQueryParams.value = { adviceType, categoryCode, searchKey: '' };
|
||||
}
|
||||
|
||||
function handleBlur(row) {
|
||||
@@ -929,20 +918,24 @@ function handleBlur(row) {
|
||||
|
||||
function handleChange(value) {
|
||||
adviceQueryParams.value.searchKey = value;
|
||||
// 搜索词变化时,调用当前行子组件的 refresh 方法
|
||||
const index = rowIndex.value;
|
||||
if (index >= 0) {
|
||||
const tableRef = Array.isArray(adviceTableRef.value) ? adviceTableRef.value[index] : adviceTableRef.value;
|
||||
// @focus 已先于 @input 执行,rowIndex 必定有效
|
||||
const currentIndex = rowIndex.value;
|
||||
if (currentIndex < 0) return;
|
||||
const row = filterPrescriptionList.value[currentIndex];
|
||||
// popover 被 blur 关闭后,用户继续输入时自行打开
|
||||
if (!row.showPopover) {
|
||||
row.showPopover = true;
|
||||
}
|
||||
const tableRef = Array.isArray(adviceTableRef.value) ? adviceTableRef.value[currentIndex] : adviceTableRef.value;
|
||||
if (tableRef && tableRef.refresh) {
|
||||
const row = filterPrescriptionList.value[index];
|
||||
const adviceType = row?.adviceType !== undefined ? row.adviceType : adviceQueryParams.value.adviceType;
|
||||
// 用 adviceType + categoryCode 组合查找匹配的选项
|
||||
let categoryCode = '';
|
||||
if (row?.adviceType !== undefined) {
|
||||
const selectValue = (adviceType == 1 && row?.categoryCode) ? '1-' + row.categoryCode : adviceType;
|
||||
const selectedItem = adviceTypeList.value.find(item => item.value === selectValue) || adviceTypeList.value.find(item => item.adviceType === adviceType);
|
||||
// 修复Bug #486:当行没有显式选择医嘱类型时,不传categoryCode,让搜索在全药库中进行
|
||||
const categoryCode = selectedItem ? selectedItem.categoryCode : (row?.adviceType !== undefined ? (adviceQueryParams.value.categoryCode || '') : '');
|
||||
tableRef.refresh(adviceType, categoryCode, value);
|
||||
categoryCode = selectedItem ? selectedItem.categoryCode : (adviceQueryParams.value.categoryCode || '');
|
||||
}
|
||||
tableRef.refresh(adviceType, categoryCode, value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1579,11 +1572,24 @@ function handleSaveGroup(orderGroupList) {
|
||||
|
||||
let successCount = 0;
|
||||
|
||||
// 收集所有要添加的新行,最后统一 unshift 到数组开头(置顶显示)
|
||||
const newRows = [];
|
||||
|
||||
// 记录循环前的数组长度,用于清理循环中创建的临时行
|
||||
const originalLength = prescriptionList.value.length;
|
||||
|
||||
orderGroupList.forEach((item) => {
|
||||
rowIndex.value = prescriptionList.value.length;
|
||||
// 使用临时索引,先追加到末尾用于 setValue 填充
|
||||
const tempIndex = prescriptionList.value.length;
|
||||
prescriptionList.value[tempIndex] = {
|
||||
uniqueKey: nextId.value++,
|
||||
isEdit: false,
|
||||
statusEnum: 1,
|
||||
};
|
||||
|
||||
if (!item) {
|
||||
console.warn('组套中的项目为空');
|
||||
prescriptionList.value.splice(tempIndex, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1609,18 +1615,12 @@ function handleSaveGroup(orderGroupList) {
|
||||
therapyEnum: item.orderDetailInfos?.therapyEnum || '1',
|
||||
};
|
||||
|
||||
// 预初始化空行(组套项带预填值,设为 false 让明细字段在表格中直接展示)
|
||||
prescriptionList.value[rowIndex.value] = {
|
||||
uniqueKey: nextId.value++,
|
||||
isEdit: false,
|
||||
statusEnum: 1,
|
||||
};
|
||||
|
||||
rowIndex.value = tempIndex;
|
||||
setValue(mergedDetail);
|
||||
|
||||
// 创建新的处方项目
|
||||
const newRow = {
|
||||
...prescriptionList.value[rowIndex.value],
|
||||
...prescriptionList.value[tempIndex],
|
||||
patientId: patientInfo.value.patientId,
|
||||
encounterId: patientInfo.value.encounterId,
|
||||
accountId: accountId.value,
|
||||
@@ -1639,12 +1639,12 @@ function handleSaveGroup(orderGroupList) {
|
||||
orgId: resolveOrgId(mergedDetail.orgId || patientInfo.value?.inHospitalOrgId) || '',
|
||||
// 🔧 修复:同时存储 orgName,确保树匹配不到时仍有中文名称可显示
|
||||
orgName: findOrgName(mergedDetail.orgId || patientInfo.value?.inHospitalOrgId) || mergedDetail.orgName || patientInfo.value?.inHospitalOrgName || '',
|
||||
dbOpType: prescriptionList.value[rowIndex.value].requestId ? '2' : '1',
|
||||
dbOpType: prescriptionList.value[tempIndex].requestId ? '2' : '1',
|
||||
conditionId: conditionId.value,
|
||||
conditionDefinitionId: conditionDefinitionId.value,
|
||||
encounterDiagnosisId: encounterDiagnosisId.value,
|
||||
diagnosisName: diagnosisName.value,
|
||||
therapyEnum: prescriptionList.value[rowIndex.value]?.therapyEnum || mergedDetail.therapyEnum || '1',
|
||||
therapyEnum: prescriptionList.value[tempIndex]?.therapyEnum || mergedDetail.therapyEnum || '1',
|
||||
// 🔧 修复:确保组套医嘱的 categoryEnum 被正确映射,防止后端 NPE
|
||||
categoryEnum: mergedDetail?.categoryEnum || mergedDetail?.categoryCode || item?.categoryCode,
|
||||
};
|
||||
@@ -1663,11 +1663,21 @@ function handleSaveGroup(orderGroupList) {
|
||||
}
|
||||
|
||||
newRow.contentJson = JSON.stringify(newRow);
|
||||
prescriptionList.value[rowIndex.value] = newRow;
|
||||
newRows.push(newRow);
|
||||
successCount++;
|
||||
});
|
||||
|
||||
if (successCount > 0) {
|
||||
// 清理循环中创建的临时行,统一添加到数组开头(置顶显示)
|
||||
if (newRows.length > 0) {
|
||||
prescriptionList.value.splice(originalLength); // 移除循环中追加到末尾的临时行
|
||||
prescriptionList.value.unshift(...newRows);
|
||||
// 排序:确保没有 requestTime 的新行始终排在最前面
|
||||
prescriptionList.value.sort((a, b) => {
|
||||
if (!a.requestTime && !b.requestTime) return 0;
|
||||
if (!a.requestTime) return -1;
|
||||
if (!b.requestTime) return 1;
|
||||
return new Date(b.requestTime) - new Date(a.requestTime);
|
||||
});
|
||||
proxy.$modal.msgSuccess(`成功添加 ${successCount} 个医嘱项`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -740,7 +740,8 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 结果表格区 -->
|
||||
<!-- 结果表格卡片 -->
|
||||
<el-card shadow="never" class="apply-card">
|
||||
<el-table
|
||||
ref="applyTableRef"
|
||||
v-loading="applyLoading"
|
||||
@@ -749,8 +750,7 @@
|
||||
@row-click="handleApplyRowClick"
|
||||
:row-class-name="tableRowClassName"
|
||||
style="width: 100%"
|
||||
max-height="340"
|
||||
:scroll="{ y: 340 }"
|
||||
max-height="320"
|
||||
>
|
||||
<el-table-column type="selection" width="55" :selectable="handleSelectable" />
|
||||
<el-table-column label="ID" align="center" width="80" fixed>
|
||||
@@ -779,19 +779,20 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="主刀医生" align="center" width="100" prop="mainSurgeonName" />
|
||||
</el-table>
|
||||
|
||||
<!-- 底部分页区 -->
|
||||
<div class="pagination-container apply-pagination">
|
||||
<!-- 分页在卡片内部 -->
|
||||
<div class="apply-pagination">
|
||||
<pagination
|
||||
v-show="applyTotal > 0"
|
||||
:total="applyTotal"
|
||||
:page="applyQueryParams.pageNo"
|
||||
:limit="applyQueryParams.pageSize"
|
||||
layout="total, sizes, prev, pager, next"
|
||||
@update:page="val => applyQueryParams.pageNo = val"
|
||||
@update:limit="val => applyQueryParams.pageSize = val"
|
||||
@pagination="getSurgicalScheduleList"
|
||||
/>
|
||||
</div>
|
||||
</el-card>
|
||||
<!-- 底部操作区 -->
|
||||
<template #footer>
|
||||
<div class="dialog-footer" style="padding-top: 12px; border-top: 1px solid #ebeef5">
|
||||
@@ -2339,19 +2340,35 @@ function getRowClassName({ row, rowIndex }) {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
/* 手术申请查询弹窗 — 分页与footer间距 */
|
||||
/* 手术申请查询弹窗 — flex 布局确保分页不溢出 */
|
||||
.surgery-apply-dialog :deep(.el-dialog__body) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-bottom: 16px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.surgery-apply-dialog :deep(.el-dialog__footer) {
|
||||
padding-top: 8px;
|
||||
padding-top: 0;
|
||||
}
|
||||
.surgery-apply-dialog :deep(.apply-card) {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
min-height: 0;
|
||||
}
|
||||
.surgery-apply-dialog :deep(.apply-card .el-card__body) {
|
||||
overflow-y: auto;
|
||||
}
|
||||
.surgery-apply-dialog :deep(.apply-pagination) {
|
||||
padding-top: 12px;
|
||||
padding-bottom: 16px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding-top: 8px;
|
||||
border-top: 1px solid #ebeef5;
|
||||
}
|
||||
.surgery-apply-dialog :deep(.apply-pagination .pagination-container) {
|
||||
margin-top: 0;
|
||||
}
|
||||
.surgery-apply-dialog :deep(.apply-pagination .el-pagination) {
|
||||
margin-right: 80px;
|
||||
position: static;
|
||||
}
|
||||
|
||||
/* 选中行样式 */
|
||||
@@ -2367,17 +2384,33 @@ function getRowClassName({ row, rowIndex }) {
|
||||
|
||||
<style>
|
||||
/* 手术申请查询弹窗 — 非 scoped 确保穿透 teleport */
|
||||
.surgery-apply-dialog .apply-pagination {
|
||||
padding-top: 12px !important;
|
||||
padding-bottom: 16px !important;
|
||||
}
|
||||
.surgery-apply-dialog .apply-pagination .el-pagination {
|
||||
margin-right: 80px !important;
|
||||
}
|
||||
.surgery-apply-dialog .el-dialog__body {
|
||||
display: flex !important;
|
||||
flex-direction: column !important;
|
||||
padding-bottom: 16px !important;
|
||||
overflow: hidden !important;
|
||||
}
|
||||
.surgery-apply-dialog .el-dialog__footer {
|
||||
padding-top: 0 !important;
|
||||
}
|
||||
.surgery-apply-dialog .apply-card {
|
||||
flex: 1 !important;
|
||||
overflow: hidden !important;
|
||||
min-height: 0 !important;
|
||||
}
|
||||
.surgery-apply-dialog .apply-card .el-card__body {
|
||||
overflow-y: auto !important;
|
||||
}
|
||||
.surgery-apply-dialog .apply-pagination {
|
||||
display: flex !important;
|
||||
justify-content: flex-end !important;
|
||||
padding-top: 8px !important;
|
||||
border-top: 1px solid #ebeef5 !important;
|
||||
}
|
||||
.surgery-apply-dialog .apply-pagination .pagination-container {
|
||||
margin-top: 0 !important;
|
||||
}
|
||||
.surgery-apply-dialog .apply-pagination .el-pagination {
|
||||
position: static !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user