14 Commits

Author SHA1 Message Date
荀彧
da2e8b5d92 Fix Bug #463: [目录管理-诊疗目录] 新增/编辑弹窗中"诊疗子项"检索功能失效,无法搜到已维护的项目
根因:ActivityDefinitionManageMapper.xml 中 getDiseaseTreatmentPage 查询使用 INNER JOIN
关联 adm_charge_item_definition 价格表,导致 55 个没有价格记录的诊疗项目被完全排除
在搜索结果之外。改为 LEFT JOIN 后,即使项目暂无价格记录也能被搜索到。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 20:15:34 +08:00
关羽
7d0c93b9a1 Fix Bug #452: 领用出库模块选择药品时提示"仓库数量为0,无法调用",与实际库存数据不符
严格批号查询返回记录但 orgQuantity=0 时,原代码直接调用 applyFromDto 并弹出警告,
未回退到非严格查询(不含 lotNumber)获取同仓库其他有库存的批号。
修复:在 applyFromDto 之前检查 orgQuantity > 0,数量为0时回退到非严格查询。
2026-05-14 19:24:03 +08:00
荀彧
87f5135ddc Fix Bug #426: 门诊医生站-检查开立:已选择列表应支持树形展开,显示套餐明细(项目/数量/单价)
修复 loadMethodPackageDetails 函数中套餐明细 API 地址错误(/system/package/ → /system/check-type/package/),导致套餐明细加载失败返回 404

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 19:06:33 +08:00
关羽
e6c0d03dc1 Fix Bug #443: 手术计费:点击"签发"耗材时异常报错
根因:签发耗材时 handDevice 方法会重复调用 saveOrUpdate 更新已有的 DeviceRequest 记录,
仅设置了部分字段(可能为 null),导致关键字段 performLocation(发放库房)被覆盖为空。
随后 handleDeviceDispense 创建 DeviceDispense 时 locationId 为 null,触发报错。

修复:签发操作(SIGN_ADVICE)跳过 handDevice 处理。因为耗材请求在保存时已创建完成,
签发只需更新状态(下方批量更新逻辑已处理),无需重新走 insert/update 流程。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 18:15:50 +08:00
赵云
5f7b75667a Fix Bug #402: 住院医生站诊断录入:点击保存诊断后,列表出现重复记录且部分条目元数据缺失
根因:后端 saveDoctorDiagnosis 先删除所有 tcm_flag=0 的记录,再用旧 encounterDiagnosisId
调用 saveOrUpdate,由于记录已删除,UPDATE 失败后 fallback 到 INSERT 导致重复记录。

修复:
1. 后端:不再设置 encounterDiagnosisId,确保 saveOrUpdate 始终执行 INSERT
2. 前端:getList() 后对诊断列表按 ybNo/name 去重,防止重复显示
3. 前端:保存前补全 diagnosisDoctor 和 diagnosisTime 元数据
4. 前端:修复 getTcmDiagnosis 的空值安全访问(res.data?.illness?.length)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 18:13:37 +08:00
赵云
2cdda279a4 Fix Bug #435: 门诊手术安排:编辑弹窗中"费用类别"字段数据未回显
根因:getSurgeryScheduleDetail 的 SQL 查询中引用了 fc.contract_name 但
未 JOIN fin_contract 表(以及关联的 adm_encounter、adm_account),导致
PostgreSQL 报错 "missing FROM-clause entry for table fc",接口返回失败,
前端费用类别字段无法获取数据。

修复:添加缺失的三表 JOIN(adm_encounter → adm_account → fin_contract),
并移除重复的 os.fee_type AS feeType 别名。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 18:13:08 +08:00
bc595e3843 bug499 【住院医生工作站-检查申请】检查申请列表缺失查询过滤功能,不符合临床高效检索要求 数据库语句报错修复 2026-05-14 18:10:46 +08:00
荀彧
53e5ee331b Fix Bug #428: 门诊医生站-检查申请:未实现分类联动检查方法及套餐明细展示与勾选逻辑
1. handleMethodSelect 中新增/更新已选项时,设置 expanded=true 使套餐明细自动展开
2. toggleItemExpand 中改用 packageDetailsDisplay/carrier.packageDetails 判断是否已加载明细
   (原代码检查非响应式的 item.packageDetails,导致重复加载或加载判断失效)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 18:09:16 +08:00
关羽
571f254d0e Fix Bug #408: 门诊医生站:检查标签页:选中检查申请记录后,“检查明细”标签页显示“暂无数据”
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 17:19:52 +08:00
关羽
560813d009 Fix Bug #412: 门诊医生站:传染病报告卡保存失败,提示报错
BeanUtils.copyProperties 不支持 DTO 中 LocalDate/LocalDateTime 到实体中 java.util.Date 的类型转换,导致 onsetDate、diagDate、reportDate、deathDate 等日期字段在拷贝后为 null。新增手动类型转换逻辑确保日期字段正确保存。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 17:16:39 +08:00
31c2acb4ef bug516 2026-05-14 16:47:21 +08:00
关羽
254de01d2e Fix Bug #523: [住院医生站-临床医嘱] 待保存医嘱总金额显示缺失且编辑态单位选择框变为数字控件
- 总金额列显示横杠: 在 setValue 中为药品类医嘱初始化 totalPrice(有 quantity 时按单价计算,否则为 '0'),确保待保存医嘱的总金额列能正常回显
- 单位选择框变数字控件: setValue 中将 unitCode/doseUnitCode/minUnitCode 统一转为 String 类型,避免 el-select 因值类型不匹配而渲染异常

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 16:31:02 +08:00
关羽
e21122edf0 Fix Bug #516: [住院医生站-临床医嘱-检验申请] 检验申请单手动填写的"发往科室"与生成的医嘱执行科室不一致
根因:后端 RequestFormManageAppServiceImpl.saveRequestForm() 完全忽略了前端传入的 positionId(用户手动选择的发往科室),
始终从 activityOrganizationConfig 配置表中查询执行科室,导致用户手动选择的科室被默认配置覆盖。

修复:在收集执行科室时优先使用 activitySaveDto.getPositionId()(前端传入的用户选择),
仅在前端未传入时 fallback 到配置表中的执行科室。

**后端开发重点**:优先搜索 Java/Spring 后端代码。
关键词:Controller, Service, Mapper, API, 接口, 数据查询
搜索目录:openhis-server-new/src/, his-repo/src/

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 16:30:13 +08:00
关羽
e9576ddfa8 Fix Bug #517: [库房管理-领用管理] 业务逻辑校验缺失:允许保存并提交领用数量大于库存数量(零库存领用)的单据
在 RequisitionIssueAppServiceImpl.addOrEditIssueReceipt() 中新增库存校验逻辑,
批量保存时校验领用数量是否超过源仓库实际库存,不足时抛出 ServiceException 阻断保存。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 16:26:35 +08:00
12 changed files with 262 additions and 86 deletions

View File

@@ -728,8 +728,12 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
/**
* 处理耗材请求
* 🔧 BugFix #443: 签发时跳过 handDevice避免重复创建 DeviceDispense 并覆盖关键字段(如 performLocation
* 签发时只需更新状态(下方 sign-advice 批量更新逻辑已处理)
*/
this.handDevice(deviceList, curDate, adviceOpType);
if (AdviceOpType.SAVE_ADVICE.getCode().equals(adviceOpType)) {
this.handDevice(deviceList, curDate, adviceOpType);
}
// 签发时,把草稿状态的账单更新为待收费
if (AdviceOpType.SIGN_ADVICE.getCode().equals(adviceOpType) && !adviceSaveList.isEmpty()) {

View File

@@ -36,6 +36,9 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;
import java.util.*;
@@ -243,7 +246,8 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn
EncounterDiagnosis encounterDiagnosis;
for (SaveDiagnosisChildParam saveDiagnosisChildParam : diagnosisChildList) {
encounterDiagnosis = new EncounterDiagnosis();
encounterDiagnosis.setId(saveDiagnosisChildParam.getEncounterDiagnosisId());
// 注意:不设置 encounterDiagnosisId,因为上面已经删除了所有记录
// 如果设置旧的 IDsaveOrUpdate 会尝试 UPDATE 不存在的记录导致失败或重复插入
encounterDiagnosis.setEncounterId(encounterId);
encounterDiagnosis.setConditionId(saveDiagnosisChildParam.getConditionId());
encounterDiagnosis.setMaindiseFlag(saveDiagnosisChildParam.getMaindiseFlag());
@@ -598,6 +602,25 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn
InfectiousDiseaseReport infectiousDiseaseReport = new InfectiousDiseaseReport();
BeanUtils.copyProperties(infectiousDiseaseReportDto, infectiousDiseaseReport);
// BeanUtils.copyProperties 不支持 LocalDate/LocalDateTime 到 java.util.Date 的类型转换,需手动处理
if (infectiousDiseaseReportDto.getOnsetDate() != null) {
infectiousDiseaseReport.setOnsetDate(
Date.from(infectiousDiseaseReportDto.getOnsetDate().atStartOfDay(ZoneId.systemDefault()).toInstant()));
}
if (infectiousDiseaseReportDto.getDiagDate() != null) {
infectiousDiseaseReport.setDiagDate(
Date.from(infectiousDiseaseReportDto.getDiagDate().atZone(ZoneId.systemDefault()).toInstant()));
}
// deathDate / reportDate 同理
if (infectiousDiseaseReportDto.getDeathDate() != null) {
infectiousDiseaseReport.setDeathDate(
Date.from(infectiousDiseaseReportDto.getDeathDate().atStartOfDay(ZoneId.systemDefault()).toInstant()));
}
if (infectiousDiseaseReportDto.getReportDate() != null) {
infectiousDiseaseReport.setReportDate(
Date.from(infectiousDiseaseReportDto.getReportDate().atStartOfDay(ZoneId.systemDefault()).toInstant()));
}
/**
* 设置创建人、删除状态、租户ID
*/

View File

@@ -3,29 +3,38 @@
*/
package com.openhis.web.inventorymanage.appservice.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.core.common.core.domain.R;
import com.core.common.exception.ServiceException;
import com.core.common.utils.*;
import com.core.common.utils.bean.BeanUtils;
import com.openhis.administration.domain.DeviceDefinition;
import com.openhis.administration.domain.Practitioner;
import com.openhis.administration.service.IDeviceDefinitionService;
import com.openhis.administration.service.IPractitionerService;
import com.openhis.common.constant.CommonConstants;
import com.openhis.common.constant.PromptMsgConstant;
import com.openhis.common.enums.*;
import com.openhis.common.utils.EnumUtils;
import com.openhis.common.utils.HisQueryUtils;
import com.openhis.medication.domain.MedicationDefinition;
import com.openhis.medication.service.IMedicationDefinitionService;
import com.openhis.web.common.dto.UnitDto;
import com.openhis.web.inventorymanage.appservice.IRequisitionIssueAppService;
import com.openhis.web.inventorymanage.dto.*;
import com.openhis.web.inventorymanage.mapper.RequisitionIssueMapper;
import com.openhis.workflow.domain.InventoryItem;
import com.openhis.workflow.domain.SupplyRequest;
import com.openhis.workflow.service.IInventoryItemService;
import com.openhis.workflow.service.ISupplyRequestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -48,6 +57,15 @@ public class RequisitionIssueAppServiceImpl implements IRequisitionIssueAppServi
@Autowired
private IPractitionerService practitionerService;
@Autowired
private IInventoryItemService inventoryItemService;
@Autowired
private IMedicationDefinitionService medicationDefinitionService;
@Autowired
private IDeviceDefinitionService deviceDefinitionService;
@Autowired
private AssignSeqUtil assignSeqUtil;
@@ -167,6 +185,10 @@ public class RequisitionIssueAppServiceImpl implements IRequisitionIssueAppServi
// 单据号取得
List<String> busNoList = requisitionIssueDtoList.stream().map(IssueDto::getBusNo).collect(Collectors.toList());
// 库存校验:领用数量不能超过源仓库实际库存
this.validateRequisitionStock(requisitionIssueDtoList);
// 请求数据取得
List<SupplyRequest> requestList = supplyRequestService.getSupplyByBusNo(busNoList.get(0));
if (!requestList.isEmpty()) {
@@ -328,4 +350,73 @@ public class RequisitionIssueAppServiceImpl implements IRequisitionIssueAppServi
}
}
}
/**
* 校验领用数量是否超过源仓库实际库存
*
* @param requisitionIssueDtoList 领用出库单据列表
*/
private void validateRequisitionStock(List<IssueDto> requisitionIssueDtoList) {
Integer tenantId = SecurityUtils.getLoginUser().getTenantId();
for (IssueDto issueDto : requisitionIssueDtoList) {
Long itemId = issueDto.getItemId();
String lotNumber = issueDto.getLotNumber();
Long sourceLocationId = issueDto.getSourceLocationId();
BigDecimal reqQuantity = issueDto.getItemQuantity();
String itemUnit = issueDto.getUnitCode();
String itemTable = issueDto.getItemTable();
// 根据物品类型查询定义信息(拆零比、常规单位、最小单位)
BigDecimal partPercent = BigDecimal.ONE;
String unitCode = itemUnit;
String minUnitCode = itemUnit;
if (CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(itemTable)) {
MedicationDefinition medDef = medicationDefinitionService.getById(itemId);
if (medDef != null) {
unitCode = medDef.getUnitCode();
minUnitCode = medDef.getMinUnitCode();
if (medDef.getPartPercent() != null) {
partPercent = medDef.getPartPercent();
}
}
} else if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(itemTable)) {
DeviceDefinition devDef = deviceDefinitionService.getById(itemId);
if (devDef != null) {
unitCode = devDef.getUnitCode();
minUnitCode = devDef.getMinUnitCode();
if (devDef.getPartPercent() != null) {
partPercent = devDef.getPartPercent();
}
}
}
// 计算领用数量折合最小单位的值
BigDecimal reqQuantityInMinUnit;
if (itemUnit.equals(unitCode)) {
// 领用单位 = 包装单位,需乘以拆零比
reqQuantityInMinUnit = reqQuantity.multiply(partPercent);
} else {
// 领用单位 = 最小单位,无需换算
reqQuantityInMinUnit = reqQuantity;
}
// 查询源仓库实际库存(按物品编号、批号、仓库匹配)
List<InventoryItem> inventoryItemList = inventoryItemService.selectInventoryByItemId(
itemId, lotNumber, sourceLocationId, tenantId);
// 累加匹配批号的总库存库存表quantity字段为最小单位
BigDecimal totalStock = BigDecimal.ZERO;
for (InventoryItem inventoryItem : inventoryItemList) {
if (inventoryItem.getLocationId().equals(sourceLocationId)) {
totalStock = totalStock.add(inventoryItem.getQuantity());
}
}
// 比较领用数量与库存
if (reqQuantityInMinUnit.compareTo(totalStock) > 0) {
throw new ServiceException("操作失败,库存数量不足");
}
}
}
}

View File

@@ -90,18 +90,26 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
// 逐个校验activityList中的项目是否都配置了执行科室并收集positionId供后续使用
// 必须在任何数据库操作之前完成全部校验,避免部分保存后异常导致脏数据
// 🔧 Bug #516: 优先使用前端传入的positionId用户手动选择的发往科室仅在未选择时使用配置的执行科室
List<ActivitySaveDto> activityList = requestFormSaveDto.getActivityList();
// 缓存校验结果,避免主循环中重复查询和可能出现的数据不一致
java.util.Map<Long, Long> activityIdToPositionIdMap = new java.util.HashMap<>();
if (activityList != null && !activityList.isEmpty()) {
for (ActivitySaveDto activitySaveDto : activityList) {
Long positionId = activityOrganizationConfig.stream()
// 优先使用前端传入的positionId用户手动选择的科室
Long frontendPositionId = activitySaveDto.getPositionId();
if (frontendPositionId != null) {
activityIdToPositionIdMap.put(activitySaveDto.getAdviceDefinitionId(), frontendPositionId);
continue;
}
// 前端未传入时,使用配置的执行科室
Long configPositionId = activityOrganizationConfig.stream()
.filter(dto -> activitySaveDto.getAdviceDefinitionId().equals(dto.getActivityDefinitionId()))
.map(ActivityOrganizationConfigDto::getOrganizationId).findFirst().orElse(null);
if (positionId == null) {
if (configPositionId == null) {
throw new ServiceException(activitySaveDto.getAdviceDefinitionName() + "未配置当前时间段的执行科室");
}
activityIdToPositionIdMap.put(activitySaveDto.getAdviceDefinitionId(), positionId);
activityIdToPositionIdMap.put(activitySaveDto.getAdviceDefinitionId(), configPositionId);
}
}

View File

@@ -91,13 +91,15 @@
os.surgery_nature AS surgeryType,
cs.incision_level AS incisionLevel,
fc.contract_name AS feeType,
os.fee_type AS feeType,
COALESCE(pi.identifier_no, ap.bus_no, '') AS identifierNo
FROM op_schedule os
LEFT JOIN adm_patient ap ON os.patient_id = ap.id
INNER JOIN cli_surgery cs ON os.oper_code = cs.surgery_no AND cs.delete_flag = '0'
LEFT JOIN adm_organization o ON cs.org_id = o.id
LEFT JOIN doc_request_form drf ON drf.prescription_no=cs.surgery_no
LEFT JOIN adm_encounter ae ON ae.id = os.visit_id AND ae.delete_flag = '0'
LEFT JOIN adm_account aa ON aa.encounter_id = ae.id AND aa.delete_flag = '0'
LEFT JOIN fin_contract fc ON fc.bus_no = aa.contract_no AND fc.delete_flag = '0'
LEFT JOIN (
SELECT patient_id, identifier_no
FROM (

View File

@@ -42,8 +42,8 @@
T5.package_name,
T6.name as sub_item_name
FROM wor_activity_definition T1
/* 只JOIN必要的价格表使用INNER JOIN避免笛卡尔积 */
INNER JOIN adm_charge_item_definition T2
/* 价格表使用LEFT JOIN避免因缺少价格记录导致搜索不到项目 */
LEFT JOIN adm_charge_item_definition T2
ON T1.id = T2.instance_id
AND T2.instance_table = 'wor_activity_definition'
/* 检验类型关联 */

View File

@@ -45,18 +45,6 @@
<if test="endDate != null and endDate != ''">
AND drf.create_time &lt;= (#{endDate}::date + INTERVAL '1 day' - INTERVAL '1 second')
</if>
<if test="status != null and status != ''">
AND CASE
WHEN MIN(wsr.status_enum) = 1 THEN 0
WHEN MIN(wsr.status_enum) = 2 THEN 1
WHEN MIN(wsr.status_enum) = 3 AND MAX(CASE WHEN wsr.performer_check_id IS NOT NULL THEN 1 ELSE 0 END) = 1 THEN 2
WHEN MIN(wsr.status_enum) = 3 THEN 4
WHEN MIN(wsr.status_enum) = 4 THEN 3
WHEN MIN(wsr.status_enum) = 5 OR MIN(wsr.status_enum) = 6 OR MIN(wsr.status_enum) = 7 THEN 7
WHEN MIN(wsr.status_enum) = 8 THEN 6
ELSE NULL
END = #{status}::integer
</if>
<if test="keyword != null and keyword != ''">
AND (drf.prescription_no ILIKE '%' || #{keyword} || '%'
OR EXISTS (
@@ -72,6 +60,19 @@
</if>
GROUP BY drf.id, drf.encounter_id, drf.prescription_no, drf.name, drf.desc_json,
drf.requester_id, drf.create_time, ap.name
<if test="status != null and status != ''">
HAVING CASE MIN(wsr.status_enum)
WHEN 1 THEN 0
WHEN 2 THEN 1
WHEN 3 THEN 4
WHEN 4 THEN 4
WHEN 5 THEN 5
WHEN 6 THEN 5
WHEN 7 THEN 5
WHEN 8 THEN 6
ELSE NULL
END = #{status}::integer
</if>
</select>
<select id="getRequestFormDetail" resultType="com.openhis.web.regdoctorstation.dto.RequestFormDetailQueryDto">

View File

@@ -1226,22 +1226,18 @@ function handleRowClick(row) {
selectedItems.value = [];
activeDetailTab.value = 'applyForm';
request({ url: `/exam/apply/${row.applyNo}`, method: 'get' }).then(async res => {
// 响应结构判定:Axios拦截器对 code===200 返回 res.dataAjaxResult体
// 但某些情况下可能返回完整 Axios 响应 {data: AjaxResult}。
// 用 res.code 判定是否已是 AjaxResult 体,避免二次解包导致 items 丢失。
const isAjaxResult = res && typeof res === 'object' && res.code !== undefined;
const ajaxBody = isAjaxResult ? res : (res.data || res);
// 响应结构: Axios拦截器对code===200返回res.dataAjaxResult体
// 结构为 { code: 200, data: examApply实体, items: [明细数组] }
const items = Array.isArray(res.items) ? res.items : [];
const dataObj = res.data || {};
// items 在 AjaxResult 顶层data 字段是 ExamApply 实体
const rawItems = Array.isArray(ajaxBody.items) ? ajaxBody.items : [];
const detailData = ajaxBody.data || {};
// 先填充表单字段
if (dataObj && typeof dataObj === 'object') Object.assign(form, dataObj);
if (detailData && typeof detailData === 'object') Object.assign(form, detailData);
if (rawItems.length > 0) {
if (items.length > 0) {
try {
// 为每个项目加载检查方法
const itemsWithMethods = await Promise.all(rawItems.map(async m => {
const itemsWithMethods = await Promise.all(items.map(async m => {
const item = {
id: m.itemCode, name: m.itemName,
price: m.itemFee || 0, quantity: 1,
@@ -1260,7 +1256,7 @@ function handleRowClick(row) {
if (m.bodyPartCode) {
try {
const methodRes = await searchCheckMethod({ checkType: m.bodyPartCode });
// Bug #384修复: 正确解析 API 返回结构
// 正确解析 API 返回结构
let methodData = methodRes?.data?.data || methodRes?.data || methodRes?.rows || methodRes;
if (!Array.isArray(methodData) && methodRes?.data && Array.isArray(methodRes.data.data)) {
methodData = methodRes.data.data;
@@ -1270,16 +1266,15 @@ function handleRowClick(row) {
id: md.id,
name: md.name,
code: md.code,
price: m.itemFee || 0, // fallback 到已保存的价格
price: m.itemFee || 0,
packageName: md.packageName || '',
packageId: md.packageId || null,
packagePrice: md.packagePrice || null, // Bug #384修复: 套餐价格
packagePrice: md.packagePrice || null,
serviceFee: md.serviceFee || null
}));
// 如果有已保存的检查方法信息,尝试匹配
// 回充已保存的检查方法
if (m.checkMethodId) {
item.selectedMethod = item.methods.find(md => md.id === m.checkMethodId) || null;
// 从已保存的方法中获取套餐信息
item.selectedMethod = item.methods.find(md => String(md.id) === String(m.checkMethodId)) || null;
if (item.selectedMethod?.packageId) {
item.isPackage = true;
item.packageId = item.selectedMethod.packageId;
@@ -1295,22 +1290,27 @@ function handleRowClick(row) {
}
} catch (err) {
console.error('加载检查方法失败', err);
// 单个项目加载失败不影响其他项目,继续返回 item
}
}
return item;
}));
// Bug #408修复: 确保明细数据正确加载到selectedItems
selectedItems.value = itemsWithMethods;
// 加载套餐明细(单个失败不影响其他项目和明细显示)
for (const it of selectedItems.value) {
if (getPackageCarrier(it)?.packageId) {
await loadPackageDetailsForItem(it);
try {
await loadPackageDetailsForItem(it);
} catch (e) {
console.error('加载套餐明细失败:', it.name, e);
}
}
it.expanded = !!getPackageCarrier(it)?.packageId;
}
syncCategoryChecked();
// Bug #384修复: 回充后更新检查方法显示
updateMethodDisplay();
// 修复【#408】加载申请单详情后自动切换到检查明细页签,确保已加载的明细数据可见
// Bug #408修复: 加载申请单详情后自动切换到检查明细页签,确保已加载的明细数据可见
activeDetailTab.value = 'applyDetail';
} catch (err) {
console.error('加载申请单详情失败', err);
@@ -1362,8 +1362,9 @@ async function handleMethodSelect(checked, method, cat) {
existingItem.isPackage = true;
existingItem.packageId = method.packageId;
existingItem.packageName = method.packageName || existingItem.packageName; // #428修复: 确保 packageName 同步
existingItem.expanded = true; // #428修复: 有套餐时默认展开,展示套餐明细
// 预加载套餐明细
loadPackageDetailsForItem(existingItem);
await loadPackageDetailsForItem(existingItem);
}
updateMethodDisplay();
return;
@@ -1399,9 +1400,10 @@ async function handleMethodSelect(checked, method, cat) {
};
selectedItems.value.push(newItem);
// 如果是套餐,预加载套餐明细
// 如果是套餐,预加载套餐明细并默认展开
if (newItem.isPackage && newItem.packageId) {
loadPackageDetailsForItem(newItem);
newItem.expanded = true;
await loadPackageDetailsForItem(newItem);
}
// 自动回填执行科室
@@ -1523,7 +1525,10 @@ async function handleItemSelect(checked, item, cat) {
// Bug #384修复 + #426修复: 展开/收起项目卡片
async function toggleItemExpand(item) {
item.expanded = !item.expanded;
if (item.expanded && (item.isPackage || item.packageName) && (!item.packageDetails || item.packageDetails.length === 0) && !item.packageDetailsLoading) {
const carrier = getPackageCarrier(item);
const hasDetails = Array.isArray(item.packageDetailsDisplay) && item.packageDetailsDisplay.length > 0
|| Array.isArray(carrier?.packageDetails) && carrier.packageDetails.length > 0;
if (item.expanded && (item.isPackage || item.packageName) && !hasDetails && !item.packageDetailsLoading) {
await loadPackageDetailsForItem(item);
}
if (item.expanded && shouldShowPackageBody(item)) {
@@ -1577,7 +1582,7 @@ async function loadMethodPackageDetails(item, method) {
const packageId = packages[0].id;
// 查询套餐明细
const detailRes = await request({
url: `/system/package/${packageId}/details`,
url: `/system/check-type/package/${packageId}/details`,
method: 'get'
});
if (detailRes.code === 200 && detailRes.data) {

View File

@@ -289,43 +289,62 @@ function getList() {
return obj;
});
form.value.diagnosisList = datas;
// form.value.diagnosisList = res.data;
// 去重:按 conditionId 去重,防止后端重复插入导致重复记录
deduplicateDiagnosisList();
emits('diagnosisSave', false);
}
});
getTcmDiagnosis({ encounterId: props.patientInfo.encounterId }).then((res) => {
console.log('getTcmDiagnosis=======>', JSON.stringify(res.data.illness));
console.log('getTcmDiagnosis=======>', JSON.stringify(res.data?.illness));
if (res.code == 200) {
if (res.data.illness.length > 0) {
diagnosisNetDatas.value = res.data.illness;
res.data.illness.forEach((item, index) => {
newList.push({
name: item.name + '-' + (res.data.symptom[index]?.name || ''),
ybNo: item.ybNo,
medTypeCode: item.medTypeCode,
diagnosisDoctor: props.patientInfo.practitionerName || props.patientInfo.doctorName || props.patientInfo.physicianName || userStore.name,
diagnosisTime: new Date().toLocaleString('zh-CN')
});
if (res.code == 200 && res.data?.illness?.length > 0) {
diagnosisNetDatas.value = res.data.illness;
res.data.illness.forEach((item, index) => {
newList.push({
name: item.name + '-' + (res.data.symptom?.[index]?.name || ''),
ybNo: item.ybNo,
medTypeCode: item.medTypeCode,
diagnosisDoctor: props.patientInfo.practitionerName || props.patientInfo.doctorName || props.patientInfo.physicianName || userStore.name,
diagnosisTime: new Date().toLocaleString('zh-CN')
});
// 将新数据添加到现有列表中
form.value.diagnosisList.push(...newList);
// 重新排序整个列表
form.value.diagnosisList.sort((a, b) => {
const aNo = typeof a.diagSrtNo === 'number' ? a.diagSrtNo : 9999;
const bNo = typeof b.diagSrtNo === 'number' ? b.diagSrtNo : 9999;
return aNo - bNo;
});
}
emits('diagnosisSave', false);
});
// 将新数据添加到现有列表中
form.value.diagnosisList.push(...newList);
// 重新排序整个列表
form.value.diagnosisList.sort((a, b) => {
const aNo = typeof a.diagSrtNo === 'number' ? a.diagSrtNo : 9999;
const bNo = typeof b.diagSrtNo === 'number' ? b.diagSrtNo : 9999;
return aNo - bNo;
});
// TCM 数据添加后也去重
deduplicateDiagnosisList();
}
emits('diagnosisSave', false);
});
getTree();
}
/**
* 诊断列表去重:按 ybNo + name 组合去重,保留第一条记录
* 防止后端 saveOrUpdate 在删除后误 INSERT 导致重复
*/
function deduplicateDiagnosisList() {
const seen = new Set();
const dedupedList = [];
for (const item of form.value.diagnosisList) {
// 使用 ybNo 和 name 组合作为唯一标识(中医诊断没有 ybNo用 name 去重)
const key = item.ybNo ? `${item.ybNo}` : `name_${item.name}`;
if (!seen.has(key)) {
seen.add(key);
dedupedList.push(item);
}
}
form.value.diagnosisList = dedupedList;
}
init();
function init() {
diagnosisInit().then((res) => {
@@ -603,6 +622,18 @@ function handleSaveDiagnosis() {
return aNo - bNo;
});
// 步骤1.5:确保每条诊断都有诊断医生和诊断时间(元数据补全)
const doctorName = props.patientInfo.practitionerName || props.patientInfo.doctorName || props.patientInfo.physicianName || userStore.name;
const now = new Date().toLocaleString('zh-CN');
sortedList.forEach((item) => {
if (!item.diagnosisDoctor) {
item.diagnosisDoctor = doctorName;
}
if (!item.diagnosisTime) {
item.diagnosisTime = now;
}
});
// 步骤2重新分配连续的序号从1开始
sortedList.forEach((item, index) => {
item.diagSrtNo = index + 1; // 这里是关键!把”诊断排序”改成新顺序

View File

@@ -325,7 +325,12 @@ const projectWithDepartment = (selectProjectIds, type) => {
}
}
if (findItem && isRelease) {
form.targetDepartment = findItem.id;
// 提交时若用户已选「发往科室」,不得用项目默认执行科室覆盖
if (type === 2 && manualDept) {
form.targetDepartment = manualDept;
} else {
form.targetDepartment = findItem.id;
}
}
}
return isRelease;
@@ -392,7 +397,7 @@ const submit = () => {
unitCode: item.priceList[0].unitCode /** 请求单位编码 */,
unitPrice: item.priceList[0].price /** 单价 */,
totalPrice: item.priceList[0].price /** 总价 */,
positionId: item.positionId || form.targetDepartment, //执行科室id未配置时使用用户手动选择的科室
positionId: form.targetDepartment || item.positionId, // 用户指定发往科室优先于项目默认执行科室
ybClassEnum: item.ybClassEnum, //类别医保编码
conditionId: item.conditionId, //诊断ID
encounterDiagnosisId: item.encounterDiagnosisId, //就诊诊断id

View File

@@ -1503,16 +1503,16 @@ function handleSaveBatch() {
}
function setValue(row) {
// 构造单位列表
// 构造单位列表,确保 value 始终为 String 类型,避免 el-select 值类型不匹配
unitCodeList.value = [
{ value: row.unitCode, label: row.unitCode_dictText, type: 'unit' },
{ value: String(row.unitCode ?? ''), label: row.unitCode_dictText, type: 'unit' },
{
value: row.doseUnitCode,
value: String(row.doseUnitCode ?? ''),
label: row.doseUnitCode_dictText,
type: 'dose',
},
{
value: row.minUnitCode,
value: String(row.minUnitCode ?? ''),
label: row.minUnitCode_dictText,
type: 'minUnit',
},
@@ -1577,9 +1577,9 @@ function setValue(row) {
orgName: row.adviceType != 3 ? undefined : (findOrgName(row.orgId || row.positionId || patientInfo.value?.inHospitalOrgId) || row.orgName || patientInfo.value?.inHospitalOrgName || ''),
// dose: undefined, Removed to preserve dose value from group package
unitCodeList: unitCodeList.value,
doseUnitCode: row.doseUnitCode,
minUnitCode: row.minUnitCode,
unitCode: row.partAttributeEnum == 1 ? row.minUnitCode : row.unitCode,
doseUnitCode: String(row.doseUnitCode ?? ''),
minUnitCode: String(row.minUnitCode ?? ''),
unitCode: row.partAttributeEnum == 1 ? String(row.minUnitCode ?? '') : String(row.unitCode ?? ''),
categoryEnum: row.categoryCode,
definitionId: row.chargeItemDefinitionId,
executeNum: 1,
@@ -1595,6 +1595,10 @@ function setValue(row) {
? new Decimal(selectedStock.price).div(row.partPercent).toFixed(6)
: prevRow.minUnitPrice,
positionName: selectedStock?.locationName,
// 🔧 Bug #523 修复:初始化 totalPrice 为 0避免总金额列显示为横杠
totalPrice: row.quantity
? new Decimal(row.quantity).mul(selectedStock?.price ?? 0).toFixed(6)
: '0',
}
: {
quantity: 1,

View File

@@ -1131,15 +1131,15 @@ function handleLocationClick(item, row, index) {
.then((res) => {
const list = res.data || [];
const d = pickBestOrgQuantityRow(list);
const strictOk = d && Number(d.orgQuantity ?? 0) > 0;
if (strictOk) {
// 严格批号查询有库存orgQuantity > 0
if (d && Number(d.orgQuantity ?? 0) > 0) {
applyFromDto(d, false);
if (Number(r.totalQuantity) <= 0) {
proxy.$message.warning('仓库数量为0无法调用');
}
persistStore();
return;
}
// 严格查询无库存或数量为0 → 回退到非严格查询(查同仓库其他批号)
if (lotTrimmed) {
return runGet(false).then((res2) => {
const list2 = res2.data || [];
@@ -1157,6 +1157,8 @@ function handleLocationClick(item, row, index) {
persistStore();
});
}
// 没有指定批号,直接提示
r.totalQuantity = 0;
r.price = 0;
proxy.$message.warning('仓库数量为0无法调用');