1 Commits

Author SHA1 Message Date
赵云
4c083cc698 Fix Bug #464: [目录管理-诊疗目录] 新增项目时"零售价"未与"诊疗子项"合计总价自动同步
根因:calculateTotalPrice中form.value.retailPrice赋值被nextTick包裹,
在多调用方(watcher/selectRow/addItem)并发时产生竞态,导致零售价更新丢失
修复:移除nextTick,改为同步赋值确保零售价实时同步总价

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 13:03:25 +08:00
36 changed files with 256 additions and 781 deletions

View File

@@ -200,10 +200,9 @@ public interface ICommonService {
* 批号匹配
*
* @param encounterIdList 就诊id列表
* @param requestIdList 医嘱请求id列表可选用于限定仅校验与当前执行医嘱关联的耗材
* @return 处理结果
*/
R<?> lotNumberMatch(List<Long> encounterIdList, List<Long> requestIdList);
R<?> lotNumberMatch(List<Long> encounterIdList);
/**
* 根据机构ID获取机构名称

View File

@@ -39,10 +39,8 @@ import com.openhis.web.common.dto.*;
import com.openhis.web.common.mapper.CommonAppMapper;
import com.openhis.web.pharmacymanage.dto.InventoryDetailDto;
import com.openhis.workflow.domain.DeviceDispense;
import com.openhis.workflow.domain.DeviceRequest;
import com.openhis.workflow.domain.InventoryItem;
import com.openhis.workflow.service.IDeviceDispenseService;
import com.openhis.workflow.service.IDeviceRequestService;
import com.openhis.workflow.service.IInventoryItemService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -101,9 +99,6 @@ public class CommonServiceImpl implements ICommonService {
@Resource
private IDeviceDispenseService deviceDispenseService;
@Resource
private IDeviceRequestService deviceRequestService;
/**
* 获取药房列表
*
@@ -683,11 +678,10 @@ public class CommonServiceImpl implements ICommonService {
* 批号匹配
*
* @param encounterIdList 就诊id列表
* @param requestIdList 医嘱请求id列表可选用于限定仅校验与当前执行医嘱关联的耗材
* @return 处理结果
*/
@Override
public R<?> lotNumberMatch(List<Long> encounterIdList, List<Long> requestIdList) {
public R<?> lotNumberMatch(List<Long> encounterIdList) {
// 查询患者待发放的药品信息
List<MedicationDispense> medicationDispenseList = medicationDispenseService
.list(new LambdaQueryWrapper<MedicationDispense>().in(MedicationDispense::getEncounterId, encounterIdList)
@@ -804,27 +798,10 @@ public class CommonServiceImpl implements ICommonService {
}
}
// 查询患者待发放的耗材信息
LambdaQueryWrapper<DeviceDispense> deviceDispenseQuery = new LambdaQueryWrapper<DeviceDispense>()
.in(DeviceDispense::getEncounterId, encounterIdList)
List<DeviceDispense> deviceDispenseList = deviceDispenseService
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getEncounterId, encounterIdList)
.eq(DeviceDispense::getStatusEnum, DispenseStatus.PREPARATION.getValue())
.eq(DeviceDispense::getDeleteFlag, DelFlag.NO.getCode());
// 若传入requestIdList则仅查询与指定医嘱请求关联的耗材避免其他未执行医嘱的耗材记录干扰
if (requestIdList != null && !requestIdList.isEmpty()) {
List<Long> deviceReqIds = deviceRequestService
.list(new LambdaQueryWrapper<DeviceRequest>()
.in(DeviceRequest::getBasedOnId, requestIdList)
.eq(DeviceRequest::getBasedOnTable, CommonConstants.TableName.WOR_SERVICE_REQUEST))
.stream()
.map(DeviceRequest::getId)
.collect(java.util.stream.Collectors.toList());
if (!deviceReqIds.isEmpty()) {
deviceDispenseQuery.in(DeviceDispense::getDeviceReqId, deviceReqIds);
} else {
// 无关联的耗材请求,直接跳过耗材校验
deviceDispenseQuery.eq(DeviceDispense::getId, -1L);
}
}
List<DeviceDispense> deviceDispenseList = deviceDispenseService.list(deviceDispenseQuery);
.eq(DeviceDispense::getDeleteFlag, DelFlag.NO.getCode()));
// 耗材批号匹配
if (deviceDispenseList != null && !deviceDispenseList.isEmpty()) {
// 获取待发放的耗材id

View File

@@ -274,13 +274,10 @@ public class CommonAppController {
* 批号匹配
*
* @param encounterIdList 就诊id列表
* @param requestIdList 医嘱请求id列表可选用于限定仅校验与当前执行医嘱关联的耗材
* @return 处理结果
*/
@GetMapping("/lot-number-match")
public R<?> lotNumberMatch(
@RequestParam(value = "encounterIdList") List<Long> encounterIdList,
@RequestParam(value = "requestIdList", required = false) List<Long> requestIdList) {
return commonService.lotNumberMatch(encounterIdList, requestIdList);
public R<?> lotNumberMatch(@RequestParam(value = "encounterIdList") List<Long> encounterIdList) {
return commonService.lotNumberMatch(encounterIdList);
}
}

View File

@@ -728,12 +728,8 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
/**
* 处理耗材请求
* 🔧 BugFix #443: 签发时跳过 handDevice避免重复创建 DeviceDispense 并覆盖关键字段(如 performLocation
* 签发时只需更新状态(下方 sign-advice 批量更新逻辑已处理)
*/
if (AdviceOpType.SAVE_ADVICE.getCode().equals(adviceOpType)) {
this.handDevice(deviceList, curDate, adviceOpType);
}
// 签发时,把草稿状态的账单更新为待收费
if (AdviceOpType.SIGN_ADVICE.getCode().equals(adviceOpType) && !adviceSaveList.isEmpty()) {
@@ -2107,9 +2103,11 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST,
CommonConstants.TableName.WOR_SERVICE_REQUEST, practitionerId, Whether.NO.getCode(),
sourceEnum, sourceBillNo);
// 🔧 修复 Bug #444: 移除手术计费场景的药品过滤。
// 原过滤会导致门诊手术医嘱界面无法获取手术计费创建的药品记录。
// 前端各组件已根据自身业务逻辑做了正确的 adviceType 过滤。
// 手术计费场景sourceBillNo 不为空时过滤掉药品1保留耗材2和诊疗3/6
if (sourceBillNo != null && !sourceBillNo.isEmpty()) {
requestBaseInfo.removeIf(dto -> dto.getAdviceType() != null
&& dto.getAdviceType() == 1);
}
for (RequestBaseDto requestBaseDto : requestBaseInfo) {
// 请求状态
requestBaseDto

View File

@@ -36,9 +36,6 @@ 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.*;
@@ -246,8 +243,7 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn
EncounterDiagnosis encounterDiagnosis;
for (SaveDiagnosisChildParam saveDiagnosisChildParam : diagnosisChildList) {
encounterDiagnosis = new EncounterDiagnosis();
// 注意:不设置 encounterDiagnosisId因为上面已经删除了所有记录
// 如果设置旧的 IDsaveOrUpdate 会尝试 UPDATE 不存在的记录导致失败或重复插入
encounterDiagnosis.setId(saveDiagnosisChildParam.getEncounterDiagnosisId());
encounterDiagnosis.setEncounterId(encounterId);
encounterDiagnosis.setConditionId(saveDiagnosisChildParam.getConditionId());
encounterDiagnosis.setMaindiseFlag(saveDiagnosisChildParam.getMaindiseFlag());
@@ -602,25 +598,6 @@ 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

@@ -96,9 +96,4 @@ public class DiagnosisQueryDto {
*/
private String diagnosisDoctor;
/**
* 是否已有传染病报卡0-无1-有)
*/
private Integer hasInfectiousReport;
}

View File

@@ -178,8 +178,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
inpatientAdviceParam.setEncounterIds(null);
Integer exeStatus = inpatientAdviceParam.getExeStatus();
inpatientAdviceParam.setExeStatus(null);
Integer requestStatus = inpatientAdviceParam.getRequestStatus();
inpatientAdviceParam.setRequestStatus(null);
// 构建查询条件
QueryWrapper<InpatientAdviceParam> queryWrapper
= HisQueryUtils.buildQueryWrapper(inpatientAdviceParam, null, null, null);
@@ -198,7 +196,7 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
ParticipantType.ADMITTING_DOCTOR.getCode(), AccountType.PERSONAL_CASH_ACCOUNT.getCode(),
ChargeItemStatus.BILLABLE.getValue(), ChargeItemStatus.BILLED.getValue(),
ChargeItemStatus.REFUNDED.getValue(), EncounterClass.IMP.getValue(),
GenerateSource.DOCTOR_PRESCRIPTION.getValue(), requestStatus);
GenerateSource.DOCTOR_PRESCRIPTION.getValue());
inpatientAdvicePage.getRecords().forEach(e -> {
// 是否皮试
e.setSkinTestFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getSkinTestFlag()));

View File

@@ -69,6 +69,5 @@ public interface AdviceProcessAppMapper {
@Param("active") Integer active, @Param("bed") Integer bed, @Param("admittingDoctor") String admittingDoctor,
@Param("personalCashAccount") String personalCashAccount, @Param("billable") Integer billable,
@Param("billed") Integer billed, @Param("refunded") Integer refunded, @Param("imp") Integer imp,
@Param("doctorPrescription") Integer doctorPrescription,
@Param("requestStatus") Integer requestStatus);
@Param("doctorPrescription") Integer doctorPrescription);
}

View File

@@ -3,38 +3,29 @@
*/
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;
@@ -57,15 +48,6 @@ 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;
@@ -185,10 +167,6 @@ 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()) {
@@ -350,73 +328,4 @@ 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

@@ -81,35 +81,28 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
Long requestFormId = requestFormSaveDto.getRequestFormId();
boolean isEdit = requestFormId != null && requestFormId != 0L;
// 校验所有activityList中的项目是否都配置了执行科室并收集positionId供后续使用
// 必须在任何数据库操作之前完成全部校验,避免部分保存后异常导致脏数据
List<ActivitySaveDto> activityList = requestFormSaveDto.getActivityList();
if (activityList == null || activityList.isEmpty()) {
throw new ServiceException("请选择检查项目");
}
// 🔧 Bug #475: 查询诊疗执行科室配置
// 诊疗执行科室配置校验(必须在任何数据库操作之前)
List<ActivityOrganizationConfigDto> activityOrganizationConfig =
requestFormManageAppMapper.getActivityOrganizationConfig(typeCode);
// 缓存校验结果,先全部验证通过后再进行数据库操作
// 优先使用前端传入的positionId用户手动选择的发往科室仅在未选择时使用配置的执行科室
java.util.Map<Long, Long> activityIdToPositionIdMap = new java.util.HashMap<>();
for (ActivitySaveDto activitySaveDto : activityList) {
// 优先使用前端传入的positionId用户手动选择的科室
Long frontendPositionId = activitySaveDto.getPositionId();
if (frontendPositionId != null) {
activityIdToPositionIdMap.put(activitySaveDto.getAdviceDefinitionId(), frontendPositionId);
continue;
if (activityOrganizationConfig.isEmpty()) {
throw new ServiceException("请先配置当前时间段的执行科室");
}
// 前端未传入时,使用配置的执行科室
Long configPositionId = activityOrganizationConfig.stream()
// 逐个校验activityList中的项目是否都配置了执行科室并收集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()
.filter(dto -> activitySaveDto.getAdviceDefinitionId().equals(dto.getActivityDefinitionId()))
.map(ActivityOrganizationConfigDto::getOrganizationId).findFirst().orElse(null);
if (configPositionId == null) {
if (positionId == null) {
throw new ServiceException(activitySaveDto.getAdviceDefinitionName() + "未配置当前时间段的执行科室");
}
activityIdToPositionIdMap.put(activitySaveDto.getAdviceDefinitionId(), configPositionId);
activityIdToPositionIdMap.put(activitySaveDto.getAdviceDefinitionId(), positionId);
}
}
// 诊疗处方号

View File

@@ -91,15 +91,13 @@
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
/* 价格表使用LEFT JOIN避免因缺少价格记录导致搜索不到项目 */
LEFT JOIN adm_charge_item_definition T2
/* 只JOIN必要的价格表使用INNER JOIN避免笛卡尔积 */
INNER JOIN adm_charge_item_definition T2
ON T1.id = T2.instance_id
AND T2.instance_table = 'wor_activity_definition'
/* 检验类型关联 */

View File

@@ -134,11 +134,7 @@
T2.yb_no,
T1.onset_date AS onsetDate,
T1.diagnosis_time AS diagnosisTime,
T1.doctor AS diagnosisDoctor,
CASE WHEN EXISTS (
SELECT 1 FROM infectious_card T4
WHERE T4.diag_id = T2.id AND T4.delete_flag = '0' AND T4.status >= 1
) THEN 1 ELSE 0 END AS hasInfectiousReport
T1.doctor AS diagnosisDoctor
FROM adm_encounter_diagnosis AS T1
LEFT JOIN cli_condition AS T2 ON T2.ID = T1.condition_id
AND T2.delete_flag = '0' AND T2.tcm_flag = 0

View File

@@ -280,17 +280,12 @@
aa.balance_amount
) AS personal_account
ON personal_account.encounter_id = ae.id
LEFT JOIN LATERAL (
SELECT status_enum
FROM med_medication_dispense
WHERE med_req_id = T1.id AND delete_flag = '0'
ORDER BY create_time DESC
LIMIT 1
) mmd ON true
LEFT JOIN med_medication_dispense mmd
ON mmd.med_req_id = T1.id
AND mmd.delete_flag = '0'
WHERE T1.delete_flag = '0'
AND T1.refund_medicine_id IS NULL
AND T1.generate_source_enum = #{doctorPrescription}
AND T1.status_enum = #{requestStatus}
AND CASE WHEN T1.status_enum = #{draft}
THEN T1.performer_check_id IS NOT NULL
ELSE 1=1 END
@@ -423,7 +418,6 @@
AND af.delete_flag = '0'
WHERE T1.delete_flag = '0'
AND T1.generate_source_enum = #{doctorPrescription}
AND T1.status_enum = #{requestStatus}
AND CASE WHEN T1.status_enum = #{draft}
THEN T1.performer_check_id IS NOT NULL
ELSE 1=1 END

View File

@@ -8,25 +8,20 @@
SELECT drf.id AS request_form_id,
drf.encounter_id,
drf.prescription_no,
COALESCE(
(SELECT STRING_AGG(DISTINCT wad.name, '、')
FROM wor_service_request wsr2
LEFT JOIN wor_activity_definition wad ON wad.id = wsr2.activity_id AND wad.delete_flag = '0'
WHERE wsr2.prescription_no = drf.prescription_no AND wsr2.delete_flag = '0'),
drf.name
) AS name,
drf.NAME,
drf.desc_json,
drf.requester_id,
drf.create_time,
ap.NAME AS patient_name,
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
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 AS status
FROM doc_request_form AS drf
@@ -45,6 +40,19 @@
<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 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>
<if test="keyword != null and keyword != ''">
AND (drf.prescription_no ILIKE '%' || #{keyword} || '%'
OR EXISTS (
@@ -60,28 +68,12 @@
</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
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>
</select>
<select id="getRequestFormDetail" resultType="com.openhis.web.regdoctorstation.dto.RequestFormDetailQueryDto">
SELECT wsr.quantity,
wsr.unit_code,
COALESCE(
wad.NAME,
wsr.content_json::jsonb->>'surgeryName',
'检验项目'
) AS advice_name,
COALESCE(wad.NAME, wsr.content_json::jsonb->>'surgeryName') AS advice_name,
aci.total_price
FROM wor_service_request AS wsr
LEFT JOIN wor_activity_definition AS wad ON wad.ID = wsr.activity_id
@@ -91,7 +83,6 @@
AND aci.delete_flag = '0'
WHERE wsr.delete_flag = '0'
AND wsr.prescription_no = #{prescriptionNo}
ORDER BY wsr.id
</select>
<select id="getActivityOrganizationConfig"
@@ -173,7 +164,7 @@
AND drf.prescription_no LIKE CONCAT('%', #{requestFormDto.surgeryNo}, '%')
</if>
<if test="requestFormDto.typeCode != null and requestFormDto.typeCode != ''">
AND drf.type_code IN (#{requestFormDto.typeCode}, 'SURGERY')
AND drf.type_code = #{requestFormDto.typeCode}
</if>
<if test="requestFormDto.applyTimeStart != null">
AND drf.create_time >= #{requestFormDto.applyTimeStart}

View File

@@ -49,11 +49,6 @@ public enum RequestStatus implements HisEnumInterface {
*/
ENDED(7, "ended", "不执行"),
/**
* 已出报告
*/
COMPLETED_REPORT(8, "completed_report", "已出报告"),
/**
* 未知
*/

View File

@@ -692,7 +692,6 @@ async function handleFoodDiseasesCheck() {
/**
* 传染病报告卡处理
* 通过诊断名称自动识别并勾选传染病报告卡中的疾病
* 修复 Bug #519跳过已有已提交报卡的诊断
*/
function handleInfectiousDiseaseReport() {
// 疾病名称到报卡编码的映射(根据传染病报告卡弹窗中的疾病列表)
@@ -744,9 +743,8 @@ function handleInfectiousDiseaseReport() {
'手足口病': '0311',
};
// 获取所有诊断名称对应的报卡编码,但跳过已有已提交报卡的诊断
// 获取所有诊断名称对应的报卡编码
const allSelectedDiseases = form.value.diagnosisList
.filter(d => d.name && d.hasInfectiousReport !== 1)
.map(d => diseaseNameToCode[d.name] || null)
.filter(code => code);
@@ -754,9 +752,9 @@ function handleInfectiousDiseaseReport() {
return;
}
// 优先使用主诊断(同样跳过已有报卡的)
const mainDiagnosis = form.value.diagnosisList.find(d => d.maindiseFlag === 1 && d.hasInfectiousReport !== 1);
const firstDiagnosis = form.value.diagnosisList.find(d => d.hasInfectiousReport !== 1) || form.value.diagnosisList[0];
// 优先使用主诊断
const mainDiagnosis = form.value.diagnosisList.find(d => d.maindiseFlag === 1);
const firstDiagnosis = form.value.diagnosisList[0];
const diagnosisToShow = {
...(mainDiagnosis || firstDiagnosis),

View File

@@ -1034,17 +1034,6 @@ function normalizeSex(value) {
return '未知';
}
function normalizeSexFromPatientInfo(patientInfo) {
// 优先使用文本字段
if (patientInfo.genderEnum_enumText) return patientInfo.genderEnum_enumText;
if (patientInfo.genderName) return patientInfo.genderName;
if (patientInfo.sex) return normalizeSex(patientInfo.sex);
// 使用数字枚举字段
if (patientInfo.genderEnum === 1) return '男';
if (patientInfo.genderEnum === 2) return '女';
return '未知';
}
function normalizeAgeUnit(value) {
const ageUnitMap = {
1: '岁',
@@ -1306,7 +1295,7 @@ async function show(diagnosisData) {
patName: patientInfo.patientName || patientInfo.name || '', // 患者姓名
parentName: '', // 家长姓名14岁以下患者必填
idNo: patientInfo.idCard, // 身份证号
sex: normalizeSexFromPatientInfo(patientInfo), // 性别
sex: patientInfo.sex || patientInfo.genderName || '男', // 性别
// 出生日期信息
birthYear: birthInfo.year, // 出生年份

View File

@@ -389,8 +389,7 @@
</el-checkbox>
<span class="item-price">¥{{ item.price }}/{{ item.unit || "" }}</span>
</div>
<!-- Bug #500修复: 使用 v-show + 占位符,避免加载提示出现/消失时高度跳变 -->
<div v-show="categoryLoadingSet.has(cat.typeId)" class="category-loading-hint">
<div v-if="categoryLoadingSet.has(cat.typeId)" class="category-loading-hint">
加载中...
</div>
<!-- Bug #428修复: 渲染分类联动加载的检查方法列表 -->
@@ -1227,18 +1226,22 @@ function handleRowClick(row) {
selectedItems.value = [];
activeDetailTab.value = 'applyForm';
request({ url: `/exam/apply/${row.applyNo}`, method: 'get' }).then(async res => {
// 响应结构: Axios拦截器对code===200返回res.dataAjaxResult体
// 结构为 { code: 200, data: examApply实体, items: [明细数组] }
const items = Array.isArray(res.items) ? res.items : [];
const dataObj = res.data || {};
// 响应结构判定: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);
// 先填充表单字段
if (dataObj && typeof dataObj === 'object') Object.assign(form, dataObj);
// items 在 AjaxResult 顶层data 字段是 ExamApply 实体
const rawItems = Array.isArray(ajaxBody.items) ? ajaxBody.items : [];
const detailData = ajaxBody.data || {};
if (items.length > 0) {
if (detailData && typeof detailData === 'object') Object.assign(form, detailData);
if (rawItems.length > 0) {
try {
// 为每个项目加载检查方法
const itemsWithMethods = await Promise.all(items.map(async m => {
const itemsWithMethods = await Promise.all(rawItems.map(async m => {
const item = {
id: m.itemCode, name: m.itemName,
price: m.itemFee || 0, quantity: 1,
@@ -1257,7 +1260,7 @@ function handleRowClick(row) {
if (m.bodyPartCode) {
try {
const methodRes = await searchCheckMethod({ checkType: m.bodyPartCode });
// 正确解析 API 返回结构
// Bug #384修复: 正确解析 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;
@@ -1267,15 +1270,16 @@ function handleRowClick(row) {
id: md.id,
name: md.name,
code: md.code,
price: m.itemFee || 0,
price: m.itemFee || 0, // fallback 到已保存的价格
packageName: md.packageName || '',
packageId: md.packageId || null,
packagePrice: md.packagePrice || null,
packagePrice: md.packagePrice || null, // Bug #384修复: 套餐价格
serviceFee: md.serviceFee || null
}));
// 回充已保存的检查方法
// 如果有已保存的检查方法信息,尝试匹配
if (m.checkMethodId) {
item.selectedMethod = item.methods.find(md => String(md.id) === String(m.checkMethodId)) || null;
item.selectedMethod = item.methods.find(md => md.id === m.checkMethodId) || null;
// 从已保存的方法中获取套餐信息
if (item.selectedMethod?.packageId) {
item.isPackage = true;
item.packageId = item.selectedMethod.packageId;
@@ -1291,27 +1295,22 @@ 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) {
try {
await loadPackageDetailsForItem(it);
} catch (e) {
console.error('加载套餐明细失败:', it.name, e);
}
}
it.expanded = !!getPackageCarrier(it)?.packageId;
}
syncCategoryChecked();
// Bug #384修复: 回充后更新检查方法显示
updateMethodDisplay();
// Bug #408修复: 加载申请单详情后自动切换到检查明细页签,确保已加载的明细数据可见
// 修复【#408】加载申请单详情后自动切换到检查明细页签,确保已加载的明细数据可见
activeDetailTab.value = 'applyDetail';
} catch (err) {
console.error('加载申请单详情失败', err);
@@ -1363,9 +1362,8 @@ 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修复: 有套餐时默认展开,展示套餐明细
// 预加载套餐明细
await loadPackageDetailsForItem(existingItem);
loadPackageDetailsForItem(existingItem);
}
updateMethodDisplay();
return;
@@ -1401,10 +1399,9 @@ async function handleMethodSelect(checked, method, cat) {
};
selectedItems.value.push(newItem);
// 如果是套餐,预加载套餐明细并默认展开
// 如果是套餐,预加载套餐明细
if (newItem.isPackage && newItem.packageId) {
newItem.expanded = true;
await loadPackageDetailsForItem(newItem);
loadPackageDetailsForItem(newItem);
}
// 自动回填执行科室
@@ -1526,10 +1523,7 @@ async function handleItemSelect(checked, item, cat) {
// Bug #384修复 + #426修复: 展开/收起项目卡片
async function toggleItemExpand(item) {
item.expanded = !item.expanded;
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) {
if (item.expanded && (item.isPackage || item.packageName) && (!item.packageDetails || item.packageDetails.length === 0) && !item.packageDetailsLoading) {
await loadPackageDetailsForItem(item);
}
if (item.expanded && shouldShowPackageBody(item)) {
@@ -1583,7 +1577,7 @@ async function loadMethodPackageDetails(item, method) {
const packageId = packages[0].id;
// 查询套餐明细
const detailRes = await request({
url: `/system/check-type/package/${packageId}/details`,
url: `/system/package/${packageId}/details`,
method: 'get'
});
if (detailRes.code === 200 && detailRes.data) {
@@ -1805,8 +1799,8 @@ defineExpose({ getList });
.collapse-scroll {
flex: 1;
overflow-y: auto;
overflow-x: hidden;
min-height: 350px; /* Bug #500: 增大最小高度,确保切换分类时容器高度不会收缩导致抖动 */
overflow-x: hidden; /* Bug #500: 防止切换时水平方向溢出导致抖动 */
min-height: 120px; /* Bug #500: 固定最小高度,避免分类切换时 flex 容器高度突变 */
}
.empty-hint {
color: #909399;
@@ -2120,18 +2114,18 @@ defineExpose({ getList });
height: auto;
line-height: 1.5;
}
/* Bug #500修复: 折叠内容不添加额外过渡动画,避免与 el-collapse 内部动画冲突导致双重动画/闪烁 */
/* Bug #500修复: 折叠内容使用明确属性过渡,避免 transition: all 导致子元素意外动画 */
:deep(.el-collapse-item__content) {
padding-bottom: 4px;
transition: height 0.3s ease, max-height 0.3s ease;
}
/* Bug #500: 折叠面板容器不加 border保持简洁 */
/* Bug #500: 折叠面板动画容器,添加 overflow:hidden 防止展开时内容溢出导致闪烁 */
:deep(.el-collapse-item__wrap) {
border: none;
overflow: hidden;
}
/* Bug #500: 分类项不加 margin 过渡,避免展开/收起时意外位移 */
:deep(.el-collapse-item) {
/* 不使用 transition,依赖 el-collapse 原生动画 */
transition: margin 0.2s ease;
}
/* Bug #500: 分类加载中提示样式 */
.category-loading-hint {

View File

@@ -56,13 +56,6 @@
</template>
</el-table-column>
<el-table-column label="申请单号" prop="applyNo" min-width="160" align="center" header-align="center" />
<el-table-column label="单据状态" prop="applyStatus" width="100" align="center" header-align="center">
<template #default="scope">
<el-tag :type="getStatusType(scope.row.applyStatus)" size="small">
{{ getStatusLabel(scope.row.applyStatus, scope.row) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="检验项目" prop="itemName" min-width="170px" align="center" header-align="center">
<template #default="scope">
<span>{{ scope.row.itemName }}</span>
@@ -1452,26 +1445,6 @@ const formatAmount = (amount) => {
return num.toFixed(2)
}
// 单据状态标签文字
const getStatusLabel = (applyStatus, row) => {
// applyStatus: 0=待开立, 1=已开立(已签发)
// 结合收费/执行标记推导更丰富的状态
if (applyStatus === 1) {
// 已收费后根据执行标记判断
if (row.needExecute === true) {
return '已执行'
}
return '已开立'
}
return '待开立'
}
// 单据状态标签颜色
const getStatusType = (applyStatus) => {
if (applyStatus === 1) return 'success'
return 'info'
}
// 格式化日期时间为字符串 YYYY-MM-DD HH:mm:ss
const formatDateTime = (date) => {
if (!date) return ''

View File

@@ -1026,7 +1026,7 @@ const mapAdviceTypeLabel = (type, adviceTableName) => {
return found.label;
}
// 🔧 Bug #458 Fix: 诊疗/手术类型字典缺失或标签为空时的兜底
// 🔧 Bug #458 Fix: 诊疗/手术类型字典缺失时的兜底,避免保存后"医嘱类型"列显示为空
if (adviceTableName === 'wor_activity_definition' || adviceTableName === 'wor_service_request') {
if (type === 6) return '手术';
if (type === 4) return '手术';
@@ -1036,15 +1036,6 @@ const mapAdviceTypeLabel = (type, adviceTableName) => {
return '诊疗';
}
// 🔧 Bug #458 Fix: 兜底映射,确保所有有效 adviceType 都有显示标签
// 不依赖字典数据和表名,直接返回标准类型名称
if (type === 3) return '诊疗';
if (type === 6) return '手术';
if (type === 4) return '耗材';
if (type === 1) return '西药';
if (type === 2) return '中成药';
if (type === 5) return '会诊';
return '';
};
@@ -1672,11 +1663,7 @@ function getListInfo(addNewRow) {
// 检查 adviceTableName如果是耗材表则应该是耗材类型
const adviceTableName = contentJson?.adviceTableName || item.adviceTableName;
// 🔧 Bug #458 Fix: 后端可能返回空字符串的 adviceType_dictText需重新计算
const backendDictText = item.adviceType_dictText;
let adviceType_dictText = (backendDictText && backendDictText.trim())
? backendDictText
: mapAdviceTypeLabel(adviceType, adviceTableName);
let adviceType_dictText = item.adviceType_dictText || mapAdviceTypeLabel(adviceType, adviceTableName);
// 如果是会诊类型,设置为会诊类型
if (isConsultation) {
@@ -3604,10 +3591,13 @@ async function setValue(row) {
prescriptionList.value[rowIndex.value].categoryEnum = 31; // 会诊的category_enum设置为31
} else {
// 诊疗类型adviceType == 3
// 🔧 Bug #455: 诊疗项目执行科室强制使用患者就诊科室
// 不使用目录配置的执行科室可能是错误ID或占位符导致显示原始ID
// 🔧 Bug Fix #238: 诊疗项目默认使用患者就诊科室
if (!prescriptionList.value[rowIndex.value].orgId) {
prescriptionList.value[rowIndex.value].orgId = props.patientInfo.orgId;
prescriptionList.value[rowIndex.value].positionName = findOrgNameById(props.patientInfo.orgId) || props.patientInfo.orgName || '';
}
if (!prescriptionList.value[rowIndex.value].positionName) {
prescriptionList.value[rowIndex.value].positionName = findOrgNameById(prescriptionList.value[rowIndex.value].orgId) || props.patientInfo.orgName || '';
}
// 🔧 Bug #218 修复使用组套中维护的quantity如果没有则默认1
prescriptionList.value[rowIndex.value].quantity = row.quantity || 1;
// 🔧 Bug #144 修复:安全访问 priceList防止 orderDetailInfos 为空时出错

View File

@@ -636,11 +636,12 @@ function getList() {
if (res.code === 200) {
surgeryList.value = res.data?.records || []
} else {
console.warn('手术列表加载失败(可能无权限或数据异常):', res.msg)
proxy.$modal.msgError(res.msg || '数据加载失败,请稍后重试')
surgeryList.value = []
}
}).catch(error => {
console.warn('手术列表请求异常:', error)
console.error('获取手术列表失败:', error)
proxy.$modal.msgError('数据加载失败,请稍后重试')
surgeryList.value = []
}).finally(() => {
loading.value = false
@@ -1141,10 +1142,7 @@ function submitForm() {
// 保存麻醉方式
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
open.value = false
// 子组件自身主动刷新列表(立即),确保数据展示不依赖父组件事件
getList()
// 通知父组件刷新医嘱列表(父组件也会带延迟再次刷新手术列表作为兜底)
emit('saved')
emit('saved') // 通知父组件刷新医嘱列表及手术申请列表
} else {
proxy.$modal.msgError(res.msg || '新增手术失败,请检查表单信息')
}
@@ -1160,10 +1158,7 @@ function submitForm() {
// 保存麻醉方式
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
open.value = false
// 子组件自身主动刷新列表(立即)
getList()
// 由父组件 @saved 事件负责刷新列表
emit('saved')
emit('saved') // 通知父组件刷新医嘱列表及手术申请列表
} else {
proxy.$modal.msgError(res.msg || '更新手术失败,请检查表单信息')
}

View File

@@ -153,7 +153,7 @@
</el-tab-pane>
<el-tab-pane label="手术申请" name="surgery">
<surgeryApplication :patientInfo="patientInfo" :activeTab="activeTab" ref="surgeryRef"
@saved="() => { prescriptionRef?.getListInfo(); setTimeout(() => surgeryRef?.getList(), 500) }" />
@saved="() => { prescriptionRef?.getListInfo(); surgeryRef?.getList() }" />
</el-tab-pane>
<el-tab-pane label="电子处方" name="eprescription">
<eprescriptionlist :patientInfo="patientInfo" ref="eprescriptionRef" />

View File

@@ -86,13 +86,10 @@
</template>
<el-table-column type="index" label="序号" width="60" align="center" />
<el-table-column prop="patientName" label="患者姓名" width="120" />
<el-table-column label="申请单名称" width="140">
<template #default="scope">
<span>{{ buildApplicationName(scope.row) }}</span>
</template>
</el-table-column>
<el-table-column prop="name" label="申请单名称" width="140" />
<el-table-column prop="createTime" label="创建时间" width="160" />
<el-table-column prop="prescriptionNo" label="申请单号" width="140" />
<el-table-column prop="requesterId_dictText" label="申请者" width="120" />
<el-table-column label="申请单状态" width="120" align="center">
<template #default="scope">
<el-tag :type="getStatusTagType(scope.row.status)" effect="plain" round>
@@ -100,7 +97,6 @@
</el-tag>
</template>
</el-table-column>
<el-table-column prop="requesterId_dictText" label="申请者" width="120" />
<el-table-column label="操作" width="280" align="center" fixed="right">
<template #default="scope">
<!-- 详情 - 所有状态都显示 -->
@@ -433,23 +429,6 @@ const parseStatus = (status) => {
return statusMap[String(status)] || '-';
};
/**
* 根据申请单详情构建申请单名称
* 单一项目:显示项目名称
* 多个项目:显示首个项目名称+"等X项"
*/
const buildApplicationName = (row) => {
const details = row.requestFormDetailList;
if (!details || details.length === 0) {
return row.name || '-';
}
if (details.length === 1) {
return details[0].adviceName || row.name || '-';
}
const first = details[0];
return `${first.adviceName || ''}${details.length}`;
};
/**
* 获取状态标签类型 - 参考临床医嘱样式
* @param {string|number} status - 状态码
@@ -534,30 +513,6 @@ const findTreeItem = (list, id) => {
return null;
};
const recursionFun = (targetDepartment) => {
if (!targetDepartment) return '';
let name = '';
for (let index = 0; index < orgOptions.value.length; index++) {
const obj = orgOptions.value[index];
if (obj.id == targetDepartment) {
name = obj.name;
break;
}
const subObjArray = obj['children'];
if (subObjArray && subObjArray.length > 0) {
for (let i = 0; i < subObjArray.length; i++) {
const item = subObjArray[i];
if (item.id == targetDepartment) {
name = item.name;
break;
}
}
}
if (name) break;
}
return name;
};
const handleViewDetail = async (row) => {
// 确保科室数据已加载,以便将 ID 解析为名称
if (!orgOptions.value || orgOptions.value.length === 0) {
@@ -571,7 +526,8 @@ const handleViewDetail = async (row) => {
const obj = JSON.parse(row.descJson);
// 将发往科室 ID 转换为名称
if (obj.targetDepartment) {
obj.targetDepartment = recursionFun(obj.targetDepartment);
const deptItem = findTreeItem(orgOptions.value, obj.targetDepartment);
obj.targetDepartment = deptItem ? deptItem.name : obj.targetDepartment;
}
descJsonData.value = obj;
} catch (e) {
@@ -678,16 +634,15 @@ const handlePrint = async (row) => {
}
// 构建 descJson 字段行(与详情弹窗展示的字段一致)
const fieldKeys = ['targetDepartment', 'urgencyLevel', 'expectedExaminationTime', 'allergyHistory', 'examinationPurpose', 'medicalHistorySummary', 'symptom', 'sign', 'clinicalDiagnosis', 'otherDiagnosis', 'relatedResult', 'attention'];
const fieldKeys = ['targetDepartment', 'symptom', 'sign', 'clinicalDiagnosis', 'otherDiagnosis', 'relatedResult', 'attention'];
let descFieldsHtml = '';
fieldKeys.forEach((key) => {
const label = labelMap[key] || key;
const value = transformField(key, descData[key]);
if (value != null && value !== '') {
if (descData[key] != null && descData[key] !== '') {
descFieldsHtml += `
<div class="info-row">
<span class="label">${label}</span>
<span class="value">${value}</span>
<span class="value">${descData[key]}</span>
</div>`;
}
});

View File

@@ -136,7 +136,7 @@
currentDetail.patientName || '-'
}}</el-descriptions-item>
<el-descriptions-item label="申请单名称">{{
buildApplicationName(currentDetail)
currentDetail.name || '-'
}}</el-descriptions-item>
<el-descriptions-item label="创建时间">{{
currentDetail.createTime || '-'
@@ -183,26 +183,6 @@
<el-button @click="detailDialogVisible = false">关闭</el-button>
</template>
</el-dialog>
<!-- 编辑检验申请单弹窗 -->
<el-dialog
v-model="editDialogVisible"
title="编辑检验申请单"
width="1200px"
destroy-on-close
top="5vh"
:close-on-click-modal="false"
>
<LaboratoryTests
ref="editFormRef"
@submitOk="handleEditSubmitOk"
:editData="editRowData"
/>
<template #footer>
<el-button @click="editDialogVisible = false">取消</el-button>
<el-button type="primary" @click="submitEditForm">确认</el-button>
</template>
</el-dialog>
</div>
</template>
@@ -212,17 +192,12 @@ import {Refresh, Search} from '@element-plus/icons-vue';
import {patientInfo} from '../../store/patient.js';
import {getInspection, deleteRequestForm, withdrawRequestForm} from './api';
import {getDepartmentList} from '@/api/public.js';
import LaboratoryTests from '../order/applicationForm/laboratoryTests.vue';
import {saveInspection} from '../order/applicationForm/api.js';
const { proxy } = getCurrentInstance();
const tableData = ref([]);
const loading = ref(false);
const detailDialogVisible = ref(false);
const editDialogVisible = ref(false);
const editRowData = ref(null);
const editFormRef = ref(null);
const currentDetail = ref(null);
const descJsonData = ref(null);
const orgOptions = ref([]);
@@ -458,32 +433,10 @@ const handleViewDetail = async (row) => {
/**
* 修改检验申请单(待签发状态)
*/
const handleEdit = async (row) => {
// 确保科室数据已加载
if (!orgOptions.value || orgOptions.value.length === 0) {
await getLocationInfo();
}
editRowData.value = row;
editDialogVisible.value = true;
};
/**
* 编辑弹窗提交成功回调
*/
const handleEditSubmitOk = async () => {
editDialogVisible.value = false;
editRowData.value = null;
proxy.$modal?.msgSuccess?.('修改成功');
await fetchData();
};
/**
* 编辑弹窗提交按钮
*/
const submitEditForm = () => {
if (editFormRef.value?.submit) {
editFormRef.value.submit();
}
const handleEdit = (row) => {
// 复用详情查看逻辑,后续可扩展为打开编辑弹窗
handleViewDetail(row);
proxy.$modal?.msgInfo?.('修改功能待接入,请通过详情弹窗查看后重新开立');
};
/**
@@ -497,7 +450,7 @@ const handleDelete = async (row) => {
}
try {
const res = await deleteRequestForm({ requestFormId: row.requestFormId });
const res = await deleteRequestForm({ prescriptionNo: row.prescriptionNo });
if (res?.code === 200) {
proxy.$modal?.msgSuccess?.('删除成功');
await fetchData();
@@ -520,7 +473,7 @@ const handleWithdraw = async (row) => {
}
try {
const res = await withdrawRequestForm({ requestFormId: row.requestFormId });
const res = await withdrawRequestForm({ prescriptionNo: row.prescriptionNo });
if (res?.code === 200) {
proxy.$modal?.msgSuccess?.('撤回成功');
await fetchData();

View File

@@ -289,19 +289,19 @@ function getList() {
return obj;
});
form.value.diagnosisList = datas;
// 去重:按 conditionId 去重,防止后端重复插入导致重复记录
deduplicateDiagnosisList();
// form.value.diagnosisList = res.data;
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 && res.data?.illness?.length > 0) {
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 || ''),
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,
@@ -318,33 +318,14 @@ function getList() {
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) => {
@@ -622,18 +603,6 @@ 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

@@ -155,13 +155,7 @@ const findTreeItem = (list, id) => {
return null;
};
const emits = defineEmits(['submitOk']);
const props = defineProps({
editData: {
type: Object,
default: null,
},
});
const isEditMode = computed(() => !!props.editData?.requestFormId);
const props = defineProps({});
const state = reactive({});
const applicationListAll = ref([]);
const loading = ref(false);
@@ -325,14 +319,9 @@ const projectWithDepartment = (selectProjectIds, type) => {
}
}
if (findItem && isRelease) {
// 提交时若用户已选「发往科室」,不得用项目默认执行科室覆盖
if (type === 2 && manualDept) {
form.targetDepartment = manualDept;
} else {
form.targetDepartment = findItem.id;
}
}
}
return isRelease;
};
// 监听选择项目变化
@@ -342,44 +331,6 @@ watch(
projectWithDepartment(newValue, 1);
}
);
// 编辑模式下,回显已有数据
watch(
() => props.editData,
(newData) => {
if (!newData || !newData.requestFormId) return;
// 解析 descJson 回填表单
if (newData.descJson) {
try {
const obj = JSON.parse(newData.descJson);
Object.keys(form).forEach((key) => {
if (obj[key] !== undefined) {
form[key] = obj[key];
}
});
} catch (e) {
console.error('解析 descJson 失败:', e);
}
}
// 回填已选项目
if (newData.requestFormDetailList && newData.requestFormDetailList.length > 0) {
// 从全部数据中匹配已选项目
const selectedIds = [];
newData.requestFormDetailList.forEach((detail) => {
const matched = applicationListAll.value.find(
(item) => item.adviceName === detail.adviceName
);
if (matched) {
selectedIds.push(matched.adviceDefinitionId);
}
});
transferValue.value = selectedIds;
}
},
{ immediate: true }
);
const submit = () => {
if (transferValue.value.length == 0) {
return proxy.$message.error('请选择申请单');
@@ -397,7 +348,7 @@ const submit = () => {
unitCode: item.priceList[0].unitCode /** 请求单位编码 */,
unitPrice: item.priceList[0].price /** 单价 */,
totalPrice: item.priceList[0].price /** 总价 */,
positionId: form.targetDepartment || item.positionId, // 用户指定发往科室优先于项目默认执行科室
positionId: item.positionId || form.targetDepartment, //执行科室id未配置时使用用户手动选择的科室
ybClassEnum: item.ybClassEnum, //类别医保编码
conditionId: item.conditionId, //诊断ID
encounterDiagnosisId: item.encounterDiagnosisId, //就诊诊断id
@@ -412,14 +363,14 @@ const submit = () => {
patientId: patientInfo.value.patientId, //患者ID
encounterId: patientInfo.value.encounterId, // 就诊ID
organizationId: patientInfo.value.inHospitalOrgId, // 医疗机构ID
requestFormId: isEditMode.value ? props.editData.requestFormId : '', // 申请单ID(编辑模式传入,新增为空)
requestFormId: '', // 申请单ID
name: '检验申请单',
descJson: JSON.stringify(form),
categoryEnum: '21', // 21 检验 22 检查 23 输血 24 手术(避开 adviceType 1-6 碰撞)
};
saveInspection(params).then((res) => {
if (res.code === 200) {
proxy.$message.success(isEditMode.value ? '修改成功' : res.msg);
proxy.$message.success(res.msg);
transferValue.value = [];
emits('submitOk');
} else {

View File

@@ -545,7 +545,6 @@ const submit = () => {
applicationListAllFilter = applicationListAllFilter.map((item) => {
return {
adviceDefinitionId: item.adviceDefinitionId,
adviceName: item.adviceName,
quantity: 1,
unitCode: item.priceList[0].unitCode,
unitPrice: item.priceList[0].price,

View File

@@ -142,11 +142,6 @@
<el-table-column label="医嘱" align="center" prop="productName" width="300">
<template #default="scope">
<template v-if="getRowDisabled(scope.row)">
<!-- 当行的 adviceType 不在当前选项列表中时显示标签而非下拉框 -->
<template v-if="!hasAdviceTypeOption(scope.row)">
<el-tag size="small" type="primary">{{ getAdviceTypeLabel(scope.row.adviceType) }}</el-tag>
</template>
<template v-else>
<el-select
style="width: 35%; margin-right: 8px"
:model-value="getRowSelectValue(scope.row)"
@@ -222,7 +217,6 @@
</template>
</el-popover>
</template>
</template>
<span v-else>{{ scope.row.adviceName }}</span>
</template>
</el-table-column>
@@ -756,31 +750,6 @@ function getRowDisabled(row) {
return row.isEdit;
}
/**
* 判断行的 adviceType 是否在当前 adviceTypeList 选项中有匹配项
* 修复 Bug #488避免 el-select 因无匹配选项而回显为纯数字
*/
function hasAdviceTypeOption(row) {
if (!row.adviceType && row.adviceType !== 0) return false;
if (row.adviceType == 1 && row.categoryCode) {
const compositeValue = '1-' + row.categoryCode;
return adviceTypeList.value.some(item => item.value === compositeValue);
}
return adviceTypeList.value.some(item => item.value === row.adviceType);
}
/**
* 将原始 adviceType 数字映射为人类可读标签
* 修复 Bug #488当 adviceType 不在选项列表中时,显示标签而非数字
*/
function getAdviceTypeLabel(type) {
if (!type && type !== 0) return '';
// 优先使用字典文本(如果后端返回了 adviceType_dictText
// 但由于当前行数据可能没有 dictText提供兜底映射
const fallbackMap = { 1: '西药', 2: '中成药', 3: '诊疗', 4: '耗材', 5: '会诊', 6: '手术', 23: '检查' };
return fallbackMap[type] || String(type);
}
/**
* 将行的 adviceType + categoryCode 映射为 el-select 的选中值
* 药品子分类使用复合值如 '1-2'adviceType-categoryCode诊疗/手术/全部使用原始值
@@ -863,22 +832,13 @@ function clickRowDb(row, column, event) {
}
row.showPopover = false;
// 仅”待签发(statusEnum==1)”允许编辑;”已签发(statusEnum==2)”及之后状态不允许编辑
// 使用 Number() 做类型转换,确保后端返回的数值能正确比较
if (Number(row.statusEnum) === 1) {
if (row.statusEnum == 1) {
// 确保治疗类型为字符串,方便与单选框 label 对齐,默认为长期医嘱('1')
row.therapyEnum = String(row.therapyEnum ?? '1');
row.isEdit = true;
const index = prescriptionList.value.findIndex((item) => item.uniqueKey === row.uniqueKey);
if (index !== -1) {
prescriptionList.value.splice(index, 1, row);
// 使用 nextTick 确保数据更新后再设置展开状态,保证 el-table 能正确识别 row-key
nextTick(() => {
prescriptionList.value[index] = row;
expandOrder.value = [row.uniqueKey];
});
} else {
console.warn('⚠️ clickRowDb 未找到匹配行: uniqueKey=', row.uniqueKey, ', row=', row);
proxy.$modal.msgWarning('无法进入编辑模式,请刷新列表后重试');
}
}
}
@@ -950,8 +910,9 @@ function handleFocus(row, index) {
// 用 adviceType + categoryCode 组合查找匹配的选项
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);
// 当行没有显式选择医嘱类型时使用已配置的默认categoryCode确保后端能返回结果
const categoryCode = row.adviceType !== undefined ? (selectedItem ? selectedItem.categoryCode : '') : (adviceQueryParams.value.categoryCode || '');
// 修复Bug #486当行没有显式选择医嘱类型时row.adviceType为undefined
// 不传categoryCode让搜索在全药库中进行只有行已选择类型时才用对应categoryCode过滤
const categoryCode = row.adviceType !== undefined ? (selectedItem ? selectedItem.categoryCode : '') : '';
const searchKey = row.adviceName || '';
nextTick(() => {
@@ -988,8 +949,9 @@ function handleChange(value) {
// 用 adviceType + categoryCode 组合查找匹配的选项
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);
// 当行没有显式选择医嘱类型时使用已配置的默认categoryCode确保后端能返回结果
const categoryCode = row?.adviceType !== undefined ? (selectedItem ? selectedItem.categoryCode : '') : (adviceQueryParams.value.categoryCode || '');
// 修复Bug #486当行没有显式选择医嘱类型时row?.adviceType为undefined
// 不传categoryCode让搜索在全药库中进行只有行已选择类型时才用对应categoryCode过滤
const categoryCode = row?.adviceType !== undefined ? (selectedItem ? selectedItem.categoryCode : '') : '';
// 修复Bug #453当adviceType为空字符串或NaN时不传具体类型让refresh函数根据searchKey决定搜索范围
const effectiveAdviceType = (adviceType && !isNaN(Number(adviceType))) ? adviceType : '';
tableRef.refresh(effectiveAdviceType, categoryCode, value);
@@ -1416,9 +1378,6 @@ function handleSaveSign(row, index) {
bindMethod.value[itemNo] = true;
}
}
}).catch(() => {
// 绑定设备接口失败不影响主流程保存,静默降级
console.warn('绑定设备检查接口调用失败adviceType=' + row.adviceType + ', itemNo=' + itemNo + '');
});
}
}
@@ -1544,16 +1503,16 @@ function handleSaveBatch() {
}
function setValue(row) {
// 构造单位列表,确保 value 始终为 String 类型,避免 el-select 值类型不匹配
// 构造单位列表
unitCodeList.value = [
{ value: String(row.unitCode ?? ''), label: row.unitCode_dictText, type: 'unit' },
{ value: row.unitCode, label: row.unitCode_dictText, type: 'unit' },
{
value: String(row.doseUnitCode ?? ''),
value: row.doseUnitCode,
label: row.doseUnitCode_dictText,
type: 'dose',
},
{
value: String(row.minUnitCode ?? ''),
value: row.minUnitCode,
label: row.minUnitCode_dictText,
type: 'minUnit',
},
@@ -1618,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: String(row.doseUnitCode ?? ''),
minUnitCode: String(row.minUnitCode ?? ''),
unitCode: row.partAttributeEnum == 1 ? String(row.minUnitCode ?? '') : String(row.unitCode ?? ''),
doseUnitCode: row.doseUnitCode,
minUnitCode: row.minUnitCode,
unitCode: row.partAttributeEnum == 1 ? row.minUnitCode : row.unitCode,
categoryEnum: row.categoryCode,
definitionId: row.chargeItemDefinitionId,
executeNum: 1,
@@ -1636,10 +1595,6 @@ 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

@@ -19,9 +19,11 @@
<el-tab-pane label="检验申请" name="test">
<TestApplication ref="testApplicationRef" :show-status-column="true" />
</el-tab-pane>
```vue
<el-tab-pane label="检查申请" name="examine">
<ExamineApplication ref="examineApplicationRef" />
</el-tab-pane>
```
<el-tab-pane label="汇总发药申请" name="summaryDrug">
<SummaryDrugApplication ref="summaryDrugApplicationRef" />
</el-tab-pane>
@@ -47,7 +49,6 @@
import {computed, onBeforeMount, onMounted, provide, reactive, ref, watch,} from 'vue';
import Emr from './emr/index.vue';
import SummaryDrugApplication from './components/applicationShow/summaryDrugApplication.vue';
import inPatientBarDoctorFold from '@/components/patientBar/inPatientBarDoctorFold.vue';
import PatientList from '@/components/PatientList/patient-list.vue';
import {localPatientInfo, updateLocalPatientInfo} from './store/localPatient';
@@ -83,7 +84,6 @@ const currentPatientInfo = ref({});
const testApplicationRef = ref();
const examineApplicationRef = ref();
const surgeryApplicationRef = ref();
const summaryDrugApplicationRef = ref();
const bloodTtransfusionAapplicationRef = ref();
// 患者列表相关逻辑

View File

@@ -1,5 +1,4 @@
<template>
<div class="fee-dialog-wrapper">
<el-dialog v-model="dialogVisible" title="补费" width="80%" :close-on-click-modal="false">
<div style="font-size: 16px; font-weight: bold; margin-bottom: 10px">
患者信息{{
@@ -252,7 +251,7 @@
</div>
</el-dialog>
<!-- 划价组套选择对话框 -->
<el-dialog v-model="groupSetDialogVisible" title="划价组套选择" width="600px" :close-on-click-modal="false" append-to-body :z-index="3000" destroy-on-close>
<el-dialog v-model="groupSetDialogVisible" title="划价组套选择" width="600px" :close-on-click-modal="false" append-to-body>
<div style="margin-bottom: 15px; display: flex; align-items: center; gap: 10px">
<el-input
v-model="groupSetSearchText"
@@ -303,7 +302,6 @@
<el-button type="primary" @click="applyGroupSet" :disabled="!selectedGroupSet">应用</el-button>
</div>
</el-dialog>
</div>
</template>
<script setup>
@@ -521,28 +519,31 @@ watch(
}
);
// 加载科室选项(递归扁平化树形结构)
// 加载科室选项(支持树形/扁平两种数据结构)
function loadDepartmentOptions() {
getOrgList()
.then((res) => {
if (!res?.data?.records?.length) {
departmentOptions.value = [];
if (res.data) {
// 尝试从树形结构中取records[0].children
if (res.data.records && res.data.records.length > 0) {
if (res.data.records[0].children && res.data.records[0].children.length > 0) {
departmentOptions.value = res.data.records[0].children;
return;
}
// 递归扁平化树形结构,提取所有科室节点
const flattenTree = (nodes) => {
const result = [];
for (const node of nodes) {
if (node?.id && node?.name) {
result.push(node);
}
if (node?.children?.length) {
result.push(...flattenTree(node.children));
// 如果 records[0] 有 id 和 name非树根节点直接用所有 records
if (res.data.records[0].id) {
departmentOptions.value = res.data.records;
return;
}
}
return result;
};
departmentOptions.value = flattenTree(res.data.records);
// 兜底:如果 records 不存在或为空,尝试直接使用 data 本身
if (Array.isArray(res.data)) {
departmentOptions.value = res.data;
return;
}
}
// 所有方式都失败,置空
departmentOptions.value = [];
})
.catch(() => {
console.warn('科室列表加载失败(可能无权限)');
@@ -605,26 +606,21 @@ function getItemType_Text(type) {
return map[type] || '其他';
}
function getUnitCodeOptions(row) {
const unitCodes = [];
// 大单位:优先用 codecode 缺失时用字典文本兜底
if (row.unitCode != null && String(row.unitCode) !== '') {
unitCodes.push({ code: String(row.unitCode), codeText: row.unitCode_dictText || String(row.unitCode) });
} else if (row.unitCode_dictText) {
unitCodes.push({ code: row.unitCode_dictText, codeText: row.unitCode_dictText });
}
// 小单位:同上
if (row.minUnitCode != null && String(row.minUnitCode) !== '') {
unitCodes.push({ code: String(row.minUnitCode), codeText: row.minUnitCode_dictText || String(row.minUnitCode) });
} else if (row.minUnitCode_dictText) {
unitCodes.push({ code: row.minUnitCode_dictText, codeText: row.minUnitCode_dictText });
}
// 去重
const unitCodes = [
{ code: row.unitCode != null ? String(row.unitCode) : null, codeText: row.unitCode_dictText },
{ code: row.minUnitCode != null ? String(row.minUnitCode) : null, codeText: row.minUnitCode_dictText },
];
// 过滤掉 code 为空的单位选项
const validUnitCodes = unitCodes.filter(item => item.code != null && item.code !== '');
// 使用 Set 来跟踪已经存在的 code
const seenCodes = new Set();
const uniqueUnitCodes = unitCodes.filter((item) => {
const uniqueUnitCodes = validUnitCodes.filter((item) => {
// 如果 Set 中没有这个 code就保留它并把它加入 Set
if (!seenCodes.has(item.code)) {
seenCodes.add(item.code);
return true;
}
// 如果已经存在,就过滤掉
return false;
});
return uniqueUnitCodes;

View File

@@ -463,45 +463,20 @@ function watchPatientSelection() {
}, 300);
}
/** 查询科室(支持树形/扁平多种响应结构) */
/** 查询科室 */
const getLocationInfo = () => {
getOrgList().then((res) => {
if (!res.data) {
orgOptions.value = [];
return;
}
// 尝试从树形结构取records[0].children
if (res.data.records && res.data.records.length > 0) {
if (res.data.records[0].children && res.data.records[0].children.length > 0) {
orgOptions.value = res.data.records[0].children;
return;
}
// 如果 records[0] 有 id 和 name非树根节点直接用所有 records
if (res.data.records[0].id) {
orgOptions.value = res.data.records;
return;
}
}
// 兜底:如果 data 本身是数组
if (Array.isArray(res.data)) {
orgOptions.value = res.data;
return;
}
orgOptions.value = [];
}).catch(() => {
console.warn('科室列表加载失败(可能无权限)');
orgOptions.value = [];
orgOptions.value = res.data?.records[0]?.children;
});
};
getLocationInfo();
// 映射(查找失败时返回 '-' 而非显示内码)
// 映射
const selectOrg = (itemid) => {
if (!itemid) return '-';
const item = orgOptions.value.find((item) => {
return item.id == itemid;
});
return item?.name || '-';
return item?.name;
};
// 重置
const onReset = () => {

View File

@@ -241,8 +241,6 @@ const loading = ref(false);
const chooseAll = ref(false);
// 独立维护选中行ID集合避免el-table内部selection状态异常导致联动全选
const selectedRowIds = ref(new Set());
// 跳过选中事件级联:程序化调用 toggleRowSelection 时阻止 handleRowSelect 触发 selectAllCheckboxesInRow
const skipSelectCascade = ref(false);
const props = defineProps({
exeStatus: {
type: Number,
@@ -486,13 +484,8 @@ function handleExecute() {
if (hasServiceRequest) {
// 仅传入选中医嘱对应的 encounterId避免其他患者的耗材记录干扰
const selectedEncounterIds = [...new Set(list.map((item) => item.encounterId).filter(Boolean))];
// 仅传入诊疗类医嘱的 requestId让后端仅校验与本次执行相关的耗材避免其他未执行医嘱的耗材记录干扰
const selectedRequestIds = list
.filter((item) => String(item.adviceTable || '') === 'wor_service_request')
.map((item) => item.requestId)
.filter(Boolean);
if (selectedEncounterIds.length > 0) {
lotNumberMatch({ encounterIdList: selectedEncounterIds, requestIdList: selectedRequestIds }, { skipErrorMsg: true })
lotNumberMatch({ encounterIdList: selectedEncounterIds }, { skipErrorMsg: true })
.then((matchRes) => {
if (matchRes && matchRes.code !== 200) {
console.warn('lotNumberMatch returned error:', matchRes.msg);
@@ -657,7 +650,6 @@ function handleRateChange(value, date, time, row, rateItem) {
}
function handelSwicthChange(value) {
skipSelectCascade.value = true;
prescriptionList.value.forEach((item, index) => {
const tableRef = proxy.$refs['tableRef' + index];
if (tableRef && tableRef[0]) {
@@ -678,15 +670,12 @@ function handelSwicthChange(value) {
}
}
});
skipSelectCascade.value = false;
}
// 默认选中全部行
function defaultSelectAllRows() {
// 清空并重建选中集合
selectedRowIds.value.clear();
// 阻止 toggleRowSelection 触发 handleRowSelect 中的 selectAllCheckboxesInRow 级联
skipSelectCascade.value = true;
prescriptionList.value.forEach((item, index) => {
const tableRef = proxy.$refs['tableRef' + index];
if (tableRef && tableRef[0]) {
@@ -699,7 +688,6 @@ function defaultSelectAllRows() {
});
}
});
skipSelectCascade.value = false;
// 更新全选开关状态
chooseAll.value = true;
}
@@ -776,7 +764,6 @@ function checkAndToggleRowSelection(row) {
const isCurrentlySelected = selectedRowIds.value.has(row.requestId);
// 根据checkbox状态更新表格行选中状态
skipSelectCascade.value = true;
if (isAllSelected && !isCurrentlySelected) {
selectedRowIds.value.add(row.requestId);
tableRef[0].toggleRowSelection(row, true);
@@ -784,7 +771,6 @@ function checkAndToggleRowSelection(row) {
selectedRowIds.value.delete(row.requestId);
tableRef[0].toggleRowSelection(row, false);
}
skipSelectCascade.value = false;
}
}
});
@@ -796,10 +782,8 @@ function handleRowSelect(selection, row, tableIndex) {
if (isSelected) {
selectedRowIds.value.add(row.requestId);
// 仅在非程序化选中时,联动选中该行内部的所有checkbox
if (!skipSelectCascade.value) {
// 选中选中该行内部的所有checkbox
selectAllCheckboxesInRow(row);
}
} else {
selectedRowIds.value.delete(row.requestId);
// 取消选中行时取消选中该行内部的所有checkbox

View File

@@ -1057,8 +1057,8 @@ function confirmCharge() {
params.recordingDate = formData.value.recordingDate || moment(new Date()).format('YYYY-MM-DD');
addVitalSigns(params).then(res => {
console.log('保存成功:', res);
if (res.code === 200) {
proxy.msgSuccess('保存成功');
// 保存成功后刷新列表
getPatientList();
// 清空表单
@@ -1087,6 +1087,8 @@ function confirmCharge() {
urineVolume: '',
stoolVolume: '',
};
// 保存成功后关闭弹窗
closeDialog();
}
});
}

View File

@@ -534,7 +534,6 @@ const userStore = useUserStore();
const openTraceNoDialog = ref(false)
const rowData = ref({})
const ypName = ref('')
const currentIndex = ref(-1)
const { proxy } = getCurrentInstance();
const { warehous_type, category_code, service_type_code, specialty_code, purchase_type } =
@@ -1073,6 +1072,13 @@ function onHeaderWarehouseChange() {
// 选择仓库 / 选药品后拉取该仓库存
function handleLocationClick(item, row, index) {
getCount({
itemId: form.purchaseinventoryList[index].itemId,
orgLocationId: form.purchaseinventoryList[index].sourceLocationId,
}).then((res) => {
if (res.data && res.data.length > 0) {
form.purchaseinventoryList[index].itemTable = res.data[0].itemTable || '';
form.purchaseinventoryList[index].totalQuantity = res.data[0].orgQuantity || 0;
const r = form.purchaseinventoryList[index];
let orgLocationId = r.sourceLocationId || receiptHeaderForm.headerLocationId || '';
if (!orgLocationId) {
@@ -1131,15 +1137,15 @@ function handleLocationClick(item, row, index) {
.then((res) => {
const list = res.data || [];
const d = pickBestOrgQuantityRow(list);
// 严格批号查询有库存orgQuantity > 0
if (d && Number(d.orgQuantity ?? 0) > 0) {
const strictOk = d && Number(d.orgQuantity ?? 0) > 0;
if (strictOk) {
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,8 +1163,6 @@ function handleLocationClick(item, row, index) {
persistStore();
});
}
// 没有指定批号,直接提示
r.totalQuantity = 0;
r.price = 0;
proxy.$message.warning('仓库数量为0无法调用');
@@ -1700,17 +1704,6 @@ const exportRequiredParams = ref({
pageSize: 10,
busNo: route.query.supplyBusNo
});
// 追溯码对话框提交处理
function submit(traceNoData) {
if (currentIndex.value >= 0 && form.purchaseinventoryList[currentIndex.value]) {
form.purchaseinventoryList[currentIndex.value].traceNo = traceNoData.traceNo;
form.purchaseinventoryList[currentIndex.value].ybNo = traceNoData.ybNo;
proxy.$message.success('追溯码保存成功');
}
openTraceNoDialog.value = false;
}
function handleExport() {
proxy.downloadGet(
'/issue-manage/requisition/excel-out',

View File

@@ -1535,8 +1535,8 @@ function handleMedicalAdvice(row) {
temporarySigned.value = hasSubmittedAdvices; // 修复:根据已有数据状态设置,而非盲目重置
temporaryMedicalLoading.value = true // 🔧 新增:开始加载
// 调用计费接口获取数据(使用手术计费来源参数,匹配 surgery billing 创建的记录)
getPrescriptionList(row.visitId, 6, row.operCode).then((res) => {
// 调用计费接口获取数据
getPrescriptionList(row.visitId).then((res) => {
console.log('=== 拉取计费数据返回结果 ===', res)
if (res.code === 200 && res.data) {
// 🔧 修复:显示所有药品请求数据,不管有没有计费项目
@@ -1741,39 +1741,27 @@ function handleTemporaryMedicalSubmit(data) {
}
})
// 🔧 修复 Bug #445: 使用稳定可靠的字段组合匹配已提交项目,从已生成列表中剔除待生成项
// 匹配键:优先使用 chargeItemId后端费用项目ID最可靠其次使用 名称+规格+数量 组合
const submittedKeys = new Set()
const submittedChargeIds = new Set()
;(data.temporaryAdvices || []).forEach(a => {
// 🔧 修复 Bug #445: 使用稳定的字段组合匹配已提交项目,而不是依赖可能为空的 requestId/chargeItemId
// 构建已提交项目的匹配键集合(药品名称 + 规格 + 数量)
const submittedKeys = new Set(
(data.temporaryAdvices || [])
.map(a => {
const om = a.originalMedicine || {}
// 收集 chargeItemId最可靠的匹配标识
if (om.chargeItemId) {
submittedChargeIds.add(om.chargeItemId)
}
// 构建名称+规格+数量的匹配键(用于无 chargeItemId 的兜底匹配)
// 注意originalMedicine 中的名称字段是 adviceName来自 billingMedicines.map 时的字段)
const name = om.medicineName || om.adviceName || om.advice_name || a.adviceName || ''
const spec = om.specification || om.volume || ''
const qty = om.quantity || 0
if (name) {
submittedKeys.add(`${name}|||${spec}|||${qty}`)
}
return `${name}|||${spec}|||${qty}`
})
.filter(k => k !== '|||0') // 过滤掉空项
)
if (submittedChargeIds.size > 0 || submittedKeys.size > 0) {
if (submittedKeys.size > 0) {
temporaryBillingMedicines.value = (temporaryBillingMedicines.value || []).filter(m => {
// 优先用 chargeItemId 匹配
if (m.chargeItemId && submittedChargeIds.has(m.chargeItemId)) {
return false
}
// 兜底用 名称+规格+数量 匹配
const key = `${m.medicineName || m.adviceName || ''}|||${m.specification || m.volume || ''}|||${m.quantity || 0}`
const key = `${m.medicineName || ''}|||${m.specification || ''}|||${m.quantity || 0}`
return !submittedKeys.has(key)
})
} else {
// 如果没有任何匹配标识,清空待生成列表(保守策略:认为所有项目都已提交)
// 如果没有任何匹配,清空待生成列表(所有项目都已提交)
temporaryBillingMedicines.value = []
}