Compare commits
36 Commits
bug464-fix
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6940c3861d | ||
|
|
6e975bf9c4 | ||
|
|
3360cccaa5 | ||
|
|
fe138589a5 | ||
|
|
270475adb9 | ||
|
|
7d0c93b9a1 | ||
|
|
87f5135ddc | ||
|
|
e6c0d03dc1 | ||
|
|
5f7b75667a | ||
|
|
2cdda279a4 | ||
| bc595e3843 | |||
|
|
53e5ee331b | ||
|
|
571f254d0e | ||
|
|
560813d009 | ||
| 31c2acb4ef | |||
|
|
254de01d2e | ||
|
|
e21122edf0 | ||
|
|
e9576ddfa8 | ||
|
|
b435de9e7b | ||
|
|
bc13fd6968 | ||
|
|
d9ad63397b | ||
|
|
bb3e1e300d | ||
|
|
46358ea03d | ||
| b5c308d9cb | |||
|
|
adfeb8f5e5 | ||
|
|
fd9309f125 | ||
|
|
46affb424e | ||
|
|
6dcee26b54 | ||
|
|
a282234bb0 | ||
|
|
52fc64c71d | ||
|
|
0bd1277307 | ||
|
|
e0e4c2bcc6 | ||
|
|
41bea23116 | ||
|
|
12382503f4 | ||
|
|
ae50a7042e | ||
|
|
9b1ac64cd6 |
@@ -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()) {
|
if (AdviceOpType.SIGN_ADVICE.getCode().equals(adviceOpType) && !adviceSaveList.isEmpty()) {
|
||||||
@@ -2103,11 +2107,9 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
|||||||
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST,
|
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST,
|
||||||
CommonConstants.TableName.WOR_SERVICE_REQUEST, practitionerId, Whether.NO.getCode(),
|
CommonConstants.TableName.WOR_SERVICE_REQUEST, practitionerId, Whether.NO.getCode(),
|
||||||
sourceEnum, sourceBillNo);
|
sourceEnum, sourceBillNo);
|
||||||
// 手术计费场景:sourceBillNo 不为空时,过滤掉药品(1),保留耗材(2)和诊疗(3/6)
|
// 🔧 修复 Bug #444: 移除手术计费场景的药品过滤。
|
||||||
if (sourceBillNo != null && !sourceBillNo.isEmpty()) {
|
// 原过滤会导致门诊手术医嘱界面无法获取手术计费创建的药品记录。
|
||||||
requestBaseInfo.removeIf(dto -> dto.getAdviceType() != null
|
// 前端各组件已根据自身业务逻辑做了正确的 adviceType 过滤。
|
||||||
&& dto.getAdviceType() == 1);
|
|
||||||
}
|
|
||||||
for (RequestBaseDto requestBaseDto : requestBaseInfo) {
|
for (RequestBaseDto requestBaseDto : requestBaseInfo) {
|
||||||
// 请求状态
|
// 请求状态
|
||||||
requestBaseDto
|
requestBaseDto
|
||||||
|
|||||||
@@ -36,6 +36,9 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@@ -243,7 +246,8 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn
|
|||||||
EncounterDiagnosis encounterDiagnosis;
|
EncounterDiagnosis encounterDiagnosis;
|
||||||
for (SaveDiagnosisChildParam saveDiagnosisChildParam : diagnosisChildList) {
|
for (SaveDiagnosisChildParam saveDiagnosisChildParam : diagnosisChildList) {
|
||||||
encounterDiagnosis = new EncounterDiagnosis();
|
encounterDiagnosis = new EncounterDiagnosis();
|
||||||
encounterDiagnosis.setId(saveDiagnosisChildParam.getEncounterDiagnosisId());
|
// 注意:不设置 encounterDiagnosisId,因为上面已经删除了所有记录
|
||||||
|
// 如果设置旧的 ID,saveOrUpdate 会尝试 UPDATE 不存在的记录导致失败或重复插入
|
||||||
encounterDiagnosis.setEncounterId(encounterId);
|
encounterDiagnosis.setEncounterId(encounterId);
|
||||||
encounterDiagnosis.setConditionId(saveDiagnosisChildParam.getConditionId());
|
encounterDiagnosis.setConditionId(saveDiagnosisChildParam.getConditionId());
|
||||||
encounterDiagnosis.setMaindiseFlag(saveDiagnosisChildParam.getMaindiseFlag());
|
encounterDiagnosis.setMaindiseFlag(saveDiagnosisChildParam.getMaindiseFlag());
|
||||||
@@ -598,6 +602,25 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn
|
|||||||
InfectiousDiseaseReport infectiousDiseaseReport = new InfectiousDiseaseReport();
|
InfectiousDiseaseReport infectiousDiseaseReport = new InfectiousDiseaseReport();
|
||||||
BeanUtils.copyProperties(infectiousDiseaseReportDto, 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
|
* 设置创建人、删除状态、租户ID
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -96,4 +96,9 @@ public class DiagnosisQueryDto {
|
|||||||
*/
|
*/
|
||||||
private String diagnosisDoctor;
|
private String diagnosisDoctor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否已有传染病报卡(0-无,1-有)
|
||||||
|
*/
|
||||||
|
private Integer hasInfectiousReport;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -178,6 +178,8 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
inpatientAdviceParam.setEncounterIds(null);
|
inpatientAdviceParam.setEncounterIds(null);
|
||||||
Integer exeStatus = inpatientAdviceParam.getExeStatus();
|
Integer exeStatus = inpatientAdviceParam.getExeStatus();
|
||||||
inpatientAdviceParam.setExeStatus(null);
|
inpatientAdviceParam.setExeStatus(null);
|
||||||
|
// requestStatus由前端tab控制,后端SQL已通过CASE条件处理校对状态过滤,无需再作为SQL条件
|
||||||
|
inpatientAdviceParam.setRequestStatus(null);
|
||||||
// 构建查询条件
|
// 构建查询条件
|
||||||
QueryWrapper<InpatientAdviceParam> queryWrapper
|
QueryWrapper<InpatientAdviceParam> queryWrapper
|
||||||
= HisQueryUtils.buildQueryWrapper(inpatientAdviceParam, null, null, null);
|
= HisQueryUtils.buildQueryWrapper(inpatientAdviceParam, null, null, null);
|
||||||
|
|||||||
@@ -3,29 +3,38 @@
|
|||||||
*/
|
*/
|
||||||
package com.openhis.web.inventorymanage.appservice.impl;
|
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.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.core.common.core.domain.R;
|
import com.core.common.core.domain.R;
|
||||||
|
import com.core.common.exception.ServiceException;
|
||||||
import com.core.common.utils.*;
|
import com.core.common.utils.*;
|
||||||
import com.core.common.utils.bean.BeanUtils;
|
import com.core.common.utils.bean.BeanUtils;
|
||||||
|
import com.openhis.administration.domain.DeviceDefinition;
|
||||||
import com.openhis.administration.domain.Practitioner;
|
import com.openhis.administration.domain.Practitioner;
|
||||||
|
import com.openhis.administration.service.IDeviceDefinitionService;
|
||||||
import com.openhis.administration.service.IPractitionerService;
|
import com.openhis.administration.service.IPractitionerService;
|
||||||
import com.openhis.common.constant.CommonConstants;
|
import com.openhis.common.constant.CommonConstants;
|
||||||
import com.openhis.common.constant.PromptMsgConstant;
|
import com.openhis.common.constant.PromptMsgConstant;
|
||||||
import com.openhis.common.enums.*;
|
import com.openhis.common.enums.*;
|
||||||
import com.openhis.common.utils.EnumUtils;
|
import com.openhis.common.utils.EnumUtils;
|
||||||
import com.openhis.common.utils.HisQueryUtils;
|
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.common.dto.UnitDto;
|
||||||
import com.openhis.web.inventorymanage.appservice.IRequisitionIssueAppService;
|
import com.openhis.web.inventorymanage.appservice.IRequisitionIssueAppService;
|
||||||
import com.openhis.web.inventorymanage.dto.*;
|
import com.openhis.web.inventorymanage.dto.*;
|
||||||
import com.openhis.web.inventorymanage.mapper.RequisitionIssueMapper;
|
import com.openhis.web.inventorymanage.mapper.RequisitionIssueMapper;
|
||||||
|
import com.openhis.workflow.domain.InventoryItem;
|
||||||
import com.openhis.workflow.domain.SupplyRequest;
|
import com.openhis.workflow.domain.SupplyRequest;
|
||||||
|
import com.openhis.workflow.service.IInventoryItemService;
|
||||||
import com.openhis.workflow.service.ISupplyRequestService;
|
import com.openhis.workflow.service.ISupplyRequestService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
@@ -48,6 +57,15 @@ public class RequisitionIssueAppServiceImpl implements IRequisitionIssueAppServi
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IPractitionerService practitionerService;
|
private IPractitionerService practitionerService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IInventoryItemService inventoryItemService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IMedicationDefinitionService medicationDefinitionService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IDeviceDefinitionService deviceDefinitionService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AssignSeqUtil assignSeqUtil;
|
private AssignSeqUtil assignSeqUtil;
|
||||||
|
|
||||||
@@ -167,6 +185,10 @@ public class RequisitionIssueAppServiceImpl implements IRequisitionIssueAppServi
|
|||||||
|
|
||||||
// 单据号取得
|
// 单据号取得
|
||||||
List<String> busNoList = requisitionIssueDtoList.stream().map(IssueDto::getBusNo).collect(Collectors.toList());
|
List<String> busNoList = requisitionIssueDtoList.stream().map(IssueDto::getBusNo).collect(Collectors.toList());
|
||||||
|
|
||||||
|
// 库存校验:领用数量不能超过源仓库实际库存
|
||||||
|
this.validateRequisitionStock(requisitionIssueDtoList);
|
||||||
|
|
||||||
// 请求数据取得
|
// 请求数据取得
|
||||||
List<SupplyRequest> requestList = supplyRequestService.getSupplyByBusNo(busNoList.get(0));
|
List<SupplyRequest> requestList = supplyRequestService.getSupplyByBusNo(busNoList.get(0));
|
||||||
if (!requestList.isEmpty()) {
|
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("操作失败,库存数量不足");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,18 +90,26 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
|
|||||||
|
|
||||||
// 逐个校验activityList中的项目是否都配置了执行科室,并收集positionId供后续使用
|
// 逐个校验activityList中的项目是否都配置了执行科室,并收集positionId供后续使用
|
||||||
// 必须在任何数据库操作之前完成全部校验,避免部分保存后异常导致脏数据
|
// 必须在任何数据库操作之前完成全部校验,避免部分保存后异常导致脏数据
|
||||||
|
// 🔧 Bug #516: 优先使用前端传入的positionId(用户手动选择的发往科室),仅在未选择时使用配置的执行科室
|
||||||
List<ActivitySaveDto> activityList = requestFormSaveDto.getActivityList();
|
List<ActivitySaveDto> activityList = requestFormSaveDto.getActivityList();
|
||||||
// 缓存校验结果,避免主循环中重复查询和可能出现的数据不一致
|
// 缓存校验结果,避免主循环中重复查询和可能出现的数据不一致
|
||||||
java.util.Map<Long, Long> activityIdToPositionIdMap = new java.util.HashMap<>();
|
java.util.Map<Long, Long> activityIdToPositionIdMap = new java.util.HashMap<>();
|
||||||
if (activityList != null && !activityList.isEmpty()) {
|
if (activityList != null && !activityList.isEmpty()) {
|
||||||
for (ActivitySaveDto activitySaveDto : activityList) {
|
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()))
|
.filter(dto -> activitySaveDto.getAdviceDefinitionId().equals(dto.getActivityDefinitionId()))
|
||||||
.map(ActivityOrganizationConfigDto::getOrganizationId).findFirst().orElse(null);
|
.map(ActivityOrganizationConfigDto::getOrganizationId).findFirst().orElse(null);
|
||||||
if (positionId == null) {
|
if (configPositionId == null) {
|
||||||
throw new ServiceException(activitySaveDto.getAdviceDefinitionName() + "未配置当前时间段的执行科室");
|
throw new ServiceException(activitySaveDto.getAdviceDefinitionName() + "未配置当前时间段的执行科室");
|
||||||
}
|
}
|
||||||
activityIdToPositionIdMap.put(activitySaveDto.getAdviceDefinitionId(), positionId);
|
activityIdToPositionIdMap.put(activitySaveDto.getAdviceDefinitionId(), configPositionId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,13 +91,15 @@
|
|||||||
os.surgery_nature AS surgeryType,
|
os.surgery_nature AS surgeryType,
|
||||||
cs.incision_level AS incisionLevel,
|
cs.incision_level AS incisionLevel,
|
||||||
fc.contract_name AS feeType,
|
fc.contract_name AS feeType,
|
||||||
os.fee_type AS feeType,
|
|
||||||
COALESCE(pi.identifier_no, ap.bus_no, '') AS identifierNo
|
COALESCE(pi.identifier_no, ap.bus_no, '') AS identifierNo
|
||||||
FROM op_schedule os
|
FROM op_schedule os
|
||||||
LEFT JOIN adm_patient ap ON os.patient_id = ap.id
|
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'
|
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 adm_organization o ON cs.org_id = o.id
|
||||||
LEFT JOIN doc_request_form drf ON drf.prescription_no=cs.surgery_no
|
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 (
|
LEFT JOIN (
|
||||||
SELECT patient_id, identifier_no
|
SELECT patient_id, identifier_no
|
||||||
FROM (
|
FROM (
|
||||||
|
|||||||
@@ -42,8 +42,8 @@
|
|||||||
T5.package_name,
|
T5.package_name,
|
||||||
T6.name as sub_item_name
|
T6.name as sub_item_name
|
||||||
FROM wor_activity_definition T1
|
FROM wor_activity_definition T1
|
||||||
/* 只JOIN必要的价格表,使用INNER JOIN避免笛卡尔积 */
|
/* 价格表使用LEFT JOIN,避免因缺少价格记录导致搜索不到项目 */
|
||||||
INNER JOIN adm_charge_item_definition T2
|
LEFT JOIN adm_charge_item_definition T2
|
||||||
ON T1.id = T2.instance_id
|
ON T1.id = T2.instance_id
|
||||||
AND T2.instance_table = 'wor_activity_definition'
|
AND T2.instance_table = 'wor_activity_definition'
|
||||||
/* 检验类型关联 */
|
/* 检验类型关联 */
|
||||||
|
|||||||
@@ -134,7 +134,11 @@
|
|||||||
T2.yb_no,
|
T2.yb_no,
|
||||||
T1.onset_date AS onsetDate,
|
T1.onset_date AS onsetDate,
|
||||||
T1.diagnosis_time AS diagnosisTime,
|
T1.diagnosis_time AS diagnosisTime,
|
||||||
T1.doctor AS diagnosisDoctor
|
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
|
||||||
FROM adm_encounter_diagnosis AS T1
|
FROM adm_encounter_diagnosis AS T1
|
||||||
LEFT JOIN cli_condition AS T2 ON T2.ID = T1.condition_id
|
LEFT JOIN cli_condition AS T2 ON T2.ID = T1.condition_id
|
||||||
AND T2.delete_flag = '0' AND T2.tcm_flag = 0
|
AND T2.delete_flag = '0' AND T2.tcm_flag = 0
|
||||||
|
|||||||
@@ -280,9 +280,13 @@
|
|||||||
aa.balance_amount
|
aa.balance_amount
|
||||||
) AS personal_account
|
) AS personal_account
|
||||||
ON personal_account.encounter_id = ae.id
|
ON personal_account.encounter_id = ae.id
|
||||||
LEFT JOIN med_medication_dispense mmd
|
LEFT JOIN LATERAL (
|
||||||
ON mmd.med_req_id = T1.id
|
SELECT status_enum
|
||||||
AND mmd.delete_flag = '0'
|
FROM med_medication_dispense
|
||||||
|
WHERE med_req_id = T1.id AND delete_flag = '0'
|
||||||
|
ORDER BY create_time DESC
|
||||||
|
LIMIT 1
|
||||||
|
) mmd ON true
|
||||||
WHERE T1.delete_flag = '0'
|
WHERE T1.delete_flag = '0'
|
||||||
AND T1.refund_medicine_id IS NULL
|
AND T1.refund_medicine_id IS NULL
|
||||||
AND T1.generate_source_enum = #{doctorPrescription}
|
AND T1.generate_source_enum = #{doctorPrescription}
|
||||||
|
|||||||
@@ -8,20 +8,25 @@
|
|||||||
SELECT drf.id AS request_form_id,
|
SELECT drf.id AS request_form_id,
|
||||||
drf.encounter_id,
|
drf.encounter_id,
|
||||||
drf.prescription_no,
|
drf.prescription_no,
|
||||||
drf.NAME,
|
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.desc_json,
|
drf.desc_json,
|
||||||
drf.requester_id,
|
drf.requester_id,
|
||||||
drf.create_time,
|
drf.create_time,
|
||||||
ap.NAME AS patient_name,
|
ap.NAME AS patient_name,
|
||||||
CASE MIN(wsr.status_enum)
|
CASE
|
||||||
WHEN 1 THEN 0
|
WHEN MIN(wsr.status_enum) = 1 THEN 0
|
||||||
WHEN 2 THEN 1
|
WHEN MIN(wsr.status_enum) = 2 THEN 1
|
||||||
WHEN 3 THEN 4
|
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 4 THEN 4
|
WHEN MIN(wsr.status_enum) = 3 THEN 4
|
||||||
WHEN 5 THEN 5
|
WHEN MIN(wsr.status_enum) = 4 THEN 3
|
||||||
WHEN 6 THEN 5
|
WHEN MIN(wsr.status_enum) = 5 OR MIN(wsr.status_enum) = 6 OR MIN(wsr.status_enum) = 7 THEN 7
|
||||||
WHEN 7 THEN 5
|
WHEN MIN(wsr.status_enum) = 8 THEN 6
|
||||||
WHEN 8 THEN 6
|
|
||||||
ELSE NULL
|
ELSE NULL
|
||||||
END AS status
|
END AS status
|
||||||
FROM doc_request_form AS drf
|
FROM doc_request_form AS drf
|
||||||
@@ -40,19 +45,6 @@
|
|||||||
<if test="endDate != null and endDate != ''">
|
<if test="endDate != null and endDate != ''">
|
||||||
AND drf.create_time <= (#{endDate}::date + INTERVAL '1 day' - INTERVAL '1 second')
|
AND drf.create_time <= (#{endDate}::date + INTERVAL '1 day' - INTERVAL '1 second')
|
||||||
</if>
|
</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 != ''">
|
<if test="keyword != null and keyword != ''">
|
||||||
AND (drf.prescription_no ILIKE '%' || #{keyword} || '%'
|
AND (drf.prescription_no ILIKE '%' || #{keyword} || '%'
|
||||||
OR EXISTS (
|
OR EXISTS (
|
||||||
@@ -68,6 +60,19 @@
|
|||||||
</if>
|
</if>
|
||||||
GROUP BY drf.id, drf.encounter_id, drf.prescription_no, drf.name, drf.desc_json,
|
GROUP BY drf.id, drf.encounter_id, drf.prescription_no, drf.name, drf.desc_json,
|
||||||
drf.requester_id, drf.create_time, ap.name
|
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>
|
||||||
|
|
||||||
<select id="getRequestFormDetail" resultType="com.openhis.web.regdoctorstation.dto.RequestFormDetailQueryDto">
|
<select id="getRequestFormDetail" resultType="com.openhis.web.regdoctorstation.dto.RequestFormDetailQueryDto">
|
||||||
@@ -164,7 +169,7 @@
|
|||||||
AND drf.prescription_no LIKE CONCAT('%', #{requestFormDto.surgeryNo}, '%')
|
AND drf.prescription_no LIKE CONCAT('%', #{requestFormDto.surgeryNo}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="requestFormDto.typeCode != null and requestFormDto.typeCode != ''">
|
<if test="requestFormDto.typeCode != null and requestFormDto.typeCode != ''">
|
||||||
AND drf.type_code = #{requestFormDto.typeCode}
|
AND drf.type_code IN (#{requestFormDto.typeCode}, 'SURGERY')
|
||||||
</if>
|
</if>
|
||||||
<if test="requestFormDto.applyTimeStart != null">
|
<if test="requestFormDto.applyTimeStart != null">
|
||||||
AND drf.create_time >= #{requestFormDto.applyTimeStart}
|
AND drf.create_time >= #{requestFormDto.applyTimeStart}
|
||||||
|
|||||||
@@ -49,6 +49,11 @@ public enum RequestStatus implements HisEnumInterface {
|
|||||||
*/
|
*/
|
||||||
ENDED(7, "ended", "不执行"),
|
ENDED(7, "ended", "不执行"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已出报告
|
||||||
|
*/
|
||||||
|
COMPLETED_REPORT(8, "completed_report", "已出报告"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 未知
|
* 未知
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -473,15 +473,12 @@ function calculateTotalPrice() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
totalPrice.value = sum.toFixed(2);
|
totalPrice.value = sum.toFixed(2);
|
||||||
// Bug #464: 零售价与诊疗子项合计总价实时同步
|
// Bug #464: 零售价与诊疗子项合计总价实时同步,直接赋值不使用nextTick避免多调用方竞争
|
||||||
const hasValidItem = treatmentItems.value.some(
|
const hasValidItem = treatmentItems.value.some(
|
||||||
(item) => item.adviceDefinitionId && item.adviceDefinitionId !== ''
|
(item) => item.adviceDefinitionId && item.adviceDefinitionId !== ''
|
||||||
);
|
);
|
||||||
if (hasValidItem) {
|
if (hasValidItem) {
|
||||||
// 使用 nextTick 确保总价更新后零售价才更新,避免 Vue 响应式时序问题
|
form.value.retailPrice = parseFloat(totalPrice.value) || 0;
|
||||||
nextTick(() => {
|
|
||||||
form.value.retailPrice = parseFloat(totalPrice.value) || 0;
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
form.value.retailPrice = undefined;
|
form.value.retailPrice = undefined;
|
||||||
}
|
}
|
||||||
@@ -763,10 +760,7 @@ function selectRow(row, index) {
|
|||||||
treatmentItems.value[index].adviceDefinitionId = row.id;
|
treatmentItems.value[index].adviceDefinitionId = row.id;
|
||||||
treatmentItems.value[index].retailPrice = row.retailPrice || 0;
|
treatmentItems.value[index].retailPrice = row.retailPrice || 0;
|
||||||
medicineSearchKey.value = '';
|
medicineSearchKey.value = '';
|
||||||
// 使用 nextTick 确保 DOM 更新后再计算总价
|
calculateTotalPrice();
|
||||||
nextTick(() => {
|
|
||||||
calculateTotalPrice();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 清空诊疗子项
|
// 清空诊疗子项
|
||||||
|
|||||||
@@ -692,6 +692,7 @@ async function handleFoodDiseasesCheck() {
|
|||||||
/**
|
/**
|
||||||
* 传染病报告卡处理
|
* 传染病报告卡处理
|
||||||
* 通过诊断名称自动识别并勾选传染病报告卡中的疾病
|
* 通过诊断名称自动识别并勾选传染病报告卡中的疾病
|
||||||
|
* 修复 Bug #519:跳过已有已提交报卡的诊断
|
||||||
*/
|
*/
|
||||||
function handleInfectiousDiseaseReport() {
|
function handleInfectiousDiseaseReport() {
|
||||||
// 疾病名称到报卡编码的映射(根据传染病报告卡弹窗中的疾病列表)
|
// 疾病名称到报卡编码的映射(根据传染病报告卡弹窗中的疾病列表)
|
||||||
@@ -743,8 +744,9 @@ function handleInfectiousDiseaseReport() {
|
|||||||
'手足口病': '0311',
|
'手足口病': '0311',
|
||||||
};
|
};
|
||||||
|
|
||||||
// 获取所有诊断名称对应的报卡编码
|
// 获取所有诊断名称对应的报卡编码,但跳过已有已提交报卡的诊断
|
||||||
const allSelectedDiseases = form.value.diagnosisList
|
const allSelectedDiseases = form.value.diagnosisList
|
||||||
|
.filter(d => d.name && d.hasInfectiousReport !== 1)
|
||||||
.map(d => diseaseNameToCode[d.name] || null)
|
.map(d => diseaseNameToCode[d.name] || null)
|
||||||
.filter(code => code);
|
.filter(code => code);
|
||||||
|
|
||||||
@@ -752,9 +754,9 @@ function handleInfectiousDiseaseReport() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 优先使用主诊断
|
// 优先使用主诊断(同样跳过已有报卡的)
|
||||||
const mainDiagnosis = form.value.diagnosisList.find(d => d.maindiseFlag === 1);
|
const mainDiagnosis = form.value.diagnosisList.find(d => d.maindiseFlag === 1 && d.hasInfectiousReport !== 1);
|
||||||
const firstDiagnosis = form.value.diagnosisList[0];
|
const firstDiagnosis = form.value.diagnosisList.find(d => d.hasInfectiousReport !== 1) || form.value.diagnosisList[0];
|
||||||
|
|
||||||
const diagnosisToShow = {
|
const diagnosisToShow = {
|
||||||
...(mainDiagnosis || firstDiagnosis),
|
...(mainDiagnosis || firstDiagnosis),
|
||||||
|
|||||||
@@ -1034,6 +1034,17 @@ function normalizeSex(value) {
|
|||||||
return '未知';
|
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) {
|
function normalizeAgeUnit(value) {
|
||||||
const ageUnitMap = {
|
const ageUnitMap = {
|
||||||
1: '岁',
|
1: '岁',
|
||||||
@@ -1295,7 +1306,7 @@ async function show(diagnosisData) {
|
|||||||
patName: patientInfo.patientName || patientInfo.name || '', // 患者姓名
|
patName: patientInfo.patientName || patientInfo.name || '', // 患者姓名
|
||||||
parentName: '', // 家长姓名(14岁以下患者必填)
|
parentName: '', // 家长姓名(14岁以下患者必填)
|
||||||
idNo: patientInfo.idCard, // 身份证号
|
idNo: patientInfo.idCard, // 身份证号
|
||||||
sex: patientInfo.sex || patientInfo.genderName || '男', // 性别
|
sex: normalizeSexFromPatientInfo(patientInfo), // 性别
|
||||||
|
|
||||||
// 出生日期信息
|
// 出生日期信息
|
||||||
birthYear: birthInfo.year, // 出生年份
|
birthYear: birthInfo.year, // 出生年份
|
||||||
|
|||||||
@@ -1226,22 +1226,18 @@ function handleRowClick(row) {
|
|||||||
selectedItems.value = [];
|
selectedItems.value = [];
|
||||||
activeDetailTab.value = 'applyForm';
|
activeDetailTab.value = 'applyForm';
|
||||||
request({ url: `/exam/apply/${row.applyNo}`, method: 'get' }).then(async res => {
|
request({ url: `/exam/apply/${row.applyNo}`, method: 'get' }).then(async res => {
|
||||||
// 响应结构判定:Axios拦截器对 code===200 返回 res.data(AjaxResult体),
|
// 响应结构: Axios拦截器对code===200返回res.data(AjaxResult体)
|
||||||
// 但某些情况下可能返回完整 Axios 响应 {data: AjaxResult}。
|
// 结构为 { code: 200, data: examApply实体, items: [明细数组] }
|
||||||
// 用 res.code 判定是否已是 AjaxResult 体,避免二次解包导致 items 丢失。
|
const items = Array.isArray(res.items) ? res.items : [];
|
||||||
const isAjaxResult = res && typeof res === 'object' && res.code !== undefined;
|
const dataObj = res.data || {};
|
||||||
const ajaxBody = isAjaxResult ? res : (res.data || res);
|
|
||||||
|
|
||||||
// items 在 AjaxResult 顶层,data 字段是 ExamApply 实体
|
// 先填充表单字段
|
||||||
const rawItems = Array.isArray(ajaxBody.items) ? ajaxBody.items : [];
|
if (dataObj && typeof dataObj === 'object') Object.assign(form, dataObj);
|
||||||
const detailData = ajaxBody.data || {};
|
|
||||||
|
|
||||||
if (detailData && typeof detailData === 'object') Object.assign(form, detailData);
|
if (items.length > 0) {
|
||||||
|
|
||||||
if (rawItems.length > 0) {
|
|
||||||
try {
|
try {
|
||||||
// 为每个项目加载检查方法
|
// 为每个项目加载检查方法
|
||||||
const itemsWithMethods = await Promise.all(rawItems.map(async m => {
|
const itemsWithMethods = await Promise.all(items.map(async m => {
|
||||||
const item = {
|
const item = {
|
||||||
id: m.itemCode, name: m.itemName,
|
id: m.itemCode, name: m.itemName,
|
||||||
price: m.itemFee || 0, quantity: 1,
|
price: m.itemFee || 0, quantity: 1,
|
||||||
@@ -1260,7 +1256,7 @@ function handleRowClick(row) {
|
|||||||
if (m.bodyPartCode) {
|
if (m.bodyPartCode) {
|
||||||
try {
|
try {
|
||||||
const methodRes = await searchCheckMethod({ checkType: m.bodyPartCode });
|
const methodRes = await searchCheckMethod({ checkType: m.bodyPartCode });
|
||||||
// Bug #384修复: 正确解析 API 返回结构
|
// 正确解析 API 返回结构
|
||||||
let methodData = methodRes?.data?.data || methodRes?.data || methodRes?.rows || methodRes;
|
let methodData = methodRes?.data?.data || methodRes?.data || methodRes?.rows || methodRes;
|
||||||
if (!Array.isArray(methodData) && methodRes?.data && Array.isArray(methodRes.data.data)) {
|
if (!Array.isArray(methodData) && methodRes?.data && Array.isArray(methodRes.data.data)) {
|
||||||
methodData = methodRes.data.data;
|
methodData = methodRes.data.data;
|
||||||
@@ -1270,16 +1266,15 @@ function handleRowClick(row) {
|
|||||||
id: md.id,
|
id: md.id,
|
||||||
name: md.name,
|
name: md.name,
|
||||||
code: md.code,
|
code: md.code,
|
||||||
price: m.itemFee || 0, // fallback 到已保存的价格
|
price: m.itemFee || 0,
|
||||||
packageName: md.packageName || '',
|
packageName: md.packageName || '',
|
||||||
packageId: md.packageId || null,
|
packageId: md.packageId || null,
|
||||||
packagePrice: md.packagePrice || null, // Bug #384修复: 套餐价格
|
packagePrice: md.packagePrice || null,
|
||||||
serviceFee: md.serviceFee || null
|
serviceFee: md.serviceFee || null
|
||||||
}));
|
}));
|
||||||
// 如果有已保存的检查方法信息,尝试匹配
|
// 回充已保存的检查方法
|
||||||
if (m.checkMethodId) {
|
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) {
|
if (item.selectedMethod?.packageId) {
|
||||||
item.isPackage = true;
|
item.isPackage = true;
|
||||||
item.packageId = item.selectedMethod.packageId;
|
item.packageId = item.selectedMethod.packageId;
|
||||||
@@ -1295,22 +1290,27 @@ function handleRowClick(row) {
|
|||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('加载检查方法失败', err);
|
console.error('加载检查方法失败', err);
|
||||||
// 单个项目加载失败不影响其他项目,继续返回 item
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
}));
|
}));
|
||||||
|
// Bug #408修复: 确保明细数据正确加载到selectedItems
|
||||||
selectedItems.value = itemsWithMethods;
|
selectedItems.value = itemsWithMethods;
|
||||||
|
// 加载套餐明细(单个失败不影响其他项目和明细显示)
|
||||||
for (const it of selectedItems.value) {
|
for (const it of selectedItems.value) {
|
||||||
if (getPackageCarrier(it)?.packageId) {
|
if (getPackageCarrier(it)?.packageId) {
|
||||||
await loadPackageDetailsForItem(it);
|
try {
|
||||||
|
await loadPackageDetailsForItem(it);
|
||||||
|
} catch (e) {
|
||||||
|
console.error('加载套餐明细失败:', it.name, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
it.expanded = !!getPackageCarrier(it)?.packageId;
|
it.expanded = !!getPackageCarrier(it)?.packageId;
|
||||||
}
|
}
|
||||||
syncCategoryChecked();
|
syncCategoryChecked();
|
||||||
// Bug #384修复: 回充后更新检查方法显示
|
// Bug #384修复: 回充后更新检查方法显示
|
||||||
updateMethodDisplay();
|
updateMethodDisplay();
|
||||||
// 修复【#408】:加载申请单详情后自动切换到检查明细页签,确保已加载的明细数据可见
|
// Bug #408修复: 加载申请单详情后自动切换到检查明细页签,确保已加载的明细数据可见
|
||||||
activeDetailTab.value = 'applyDetail';
|
activeDetailTab.value = 'applyDetail';
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('加载申请单详情失败', err);
|
console.error('加载申请单详情失败', err);
|
||||||
@@ -1362,8 +1362,9 @@ async function handleMethodSelect(checked, method, cat) {
|
|||||||
existingItem.isPackage = true;
|
existingItem.isPackage = true;
|
||||||
existingItem.packageId = method.packageId;
|
existingItem.packageId = method.packageId;
|
||||||
existingItem.packageName = method.packageName || existingItem.packageName; // #428修复: 确保 packageName 同步
|
existingItem.packageName = method.packageName || existingItem.packageName; // #428修复: 确保 packageName 同步
|
||||||
|
existingItem.expanded = true; // #428修复: 有套餐时默认展开,展示套餐明细
|
||||||
// 预加载套餐明细
|
// 预加载套餐明细
|
||||||
loadPackageDetailsForItem(existingItem);
|
await loadPackageDetailsForItem(existingItem);
|
||||||
}
|
}
|
||||||
updateMethodDisplay();
|
updateMethodDisplay();
|
||||||
return;
|
return;
|
||||||
@@ -1399,9 +1400,10 @@ async function handleMethodSelect(checked, method, cat) {
|
|||||||
};
|
};
|
||||||
selectedItems.value.push(newItem);
|
selectedItems.value.push(newItem);
|
||||||
|
|
||||||
// 如果是套餐,预加载套餐明细
|
// 如果是套餐,预加载套餐明细并默认展开
|
||||||
if (newItem.isPackage && newItem.packageId) {
|
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修复: 展开/收起项目卡片
|
// Bug #384修复 + #426修复: 展开/收起项目卡片
|
||||||
async function toggleItemExpand(item) {
|
async function toggleItemExpand(item) {
|
||||||
item.expanded = !item.expanded;
|
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);
|
await loadPackageDetailsForItem(item);
|
||||||
}
|
}
|
||||||
if (item.expanded && shouldShowPackageBody(item)) {
|
if (item.expanded && shouldShowPackageBody(item)) {
|
||||||
@@ -1577,7 +1582,7 @@ async function loadMethodPackageDetails(item, method) {
|
|||||||
const packageId = packages[0].id;
|
const packageId = packages[0].id;
|
||||||
// 查询套餐明细
|
// 查询套餐明细
|
||||||
const detailRes = await request({
|
const detailRes = await request({
|
||||||
url: `/system/package/${packageId}/details`,
|
url: `/system/check-type/package/${packageId}/details`,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
});
|
});
|
||||||
if (detailRes.code === 200 && detailRes.data) {
|
if (detailRes.code === 200 && detailRes.data) {
|
||||||
|
|||||||
@@ -56,6 +56,13 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="申请单号" prop="applyNo" min-width="160" align="center" header-align="center" />
|
<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">
|
<el-table-column label="检验项目" prop="itemName" min-width="170px" align="center" header-align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span>{{ scope.row.itemName }}</span>
|
<span>{{ scope.row.itemName }}</span>
|
||||||
@@ -1445,6 +1452,26 @@ const formatAmount = (amount) => {
|
|||||||
return num.toFixed(2)
|
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
|
// 格式化日期时间为字符串 YYYY-MM-DD HH:mm:ss
|
||||||
const formatDateTime = (date) => {
|
const formatDateTime = (date) => {
|
||||||
if (!date) return ''
|
if (!date) return ''
|
||||||
|
|||||||
@@ -1026,7 +1026,7 @@ const mapAdviceTypeLabel = (type, adviceTableName) => {
|
|||||||
return found.label;
|
return found.label;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 🔧 Bug #458 Fix: 诊疗/手术类型字典缺失时的兜底,避免保存后"医嘱类型"列显示为空
|
// 🔧 Bug #458 Fix: 诊疗/手术类型字典缺失或标签为空时的兜底
|
||||||
if (adviceTableName === 'wor_activity_definition' || adviceTableName === 'wor_service_request') {
|
if (adviceTableName === 'wor_activity_definition' || adviceTableName === 'wor_service_request') {
|
||||||
if (type === 6) return '手术';
|
if (type === 6) return '手术';
|
||||||
if (type === 4) return '手术';
|
if (type === 4) return '手术';
|
||||||
@@ -1036,6 +1036,15 @@ const mapAdviceTypeLabel = (type, adviceTableName) => {
|
|||||||
return '诊疗';
|
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 '';
|
return '';
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1663,7 +1672,11 @@ function getListInfo(addNewRow) {
|
|||||||
// 检查 adviceTableName,如果是耗材表则应该是耗材类型
|
// 检查 adviceTableName,如果是耗材表则应该是耗材类型
|
||||||
const adviceTableName = contentJson?.adviceTableName || item.adviceTableName;
|
const adviceTableName = contentJson?.adviceTableName || item.adviceTableName;
|
||||||
|
|
||||||
let adviceType_dictText = item.adviceType_dictText || mapAdviceTypeLabel(adviceType, adviceTableName);
|
// 🔧 Bug #458 Fix: 后端可能返回空字符串的 adviceType_dictText,需重新计算
|
||||||
|
const backendDictText = item.adviceType_dictText;
|
||||||
|
let adviceType_dictText = (backendDictText && backendDictText.trim())
|
||||||
|
? backendDictText
|
||||||
|
: mapAdviceTypeLabel(adviceType, adviceTableName);
|
||||||
|
|
||||||
// 如果是会诊类型,设置为会诊类型
|
// 如果是会诊类型,设置为会诊类型
|
||||||
if (isConsultation) {
|
if (isConsultation) {
|
||||||
@@ -3591,13 +3604,10 @@ async function setValue(row) {
|
|||||||
prescriptionList.value[rowIndex.value].categoryEnum = 31; // 会诊的category_enum设置为31
|
prescriptionList.value[rowIndex.value].categoryEnum = 31; // 会诊的category_enum设置为31
|
||||||
} else {
|
} else {
|
||||||
// 诊疗类型(adviceType == 3)
|
// 诊疗类型(adviceType == 3)
|
||||||
// 🔧 Bug Fix #238: 诊疗项目默认使用患者就诊科室
|
// 🔧 Bug #455: 诊疗项目执行科室强制使用患者就诊科室,
|
||||||
if (!prescriptionList.value[rowIndex.value].orgId) {
|
// 不使用目录配置的执行科室(可能是错误ID或占位符,导致显示原始ID)
|
||||||
prescriptionList.value[rowIndex.value].orgId = props.patientInfo.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
|
// 🔧 Bug #218 修复:使用组套中维护的quantity,如果没有则默认1
|
||||||
prescriptionList.value[rowIndex.value].quantity = row.quantity || 1;
|
prescriptionList.value[rowIndex.value].quantity = row.quantity || 1;
|
||||||
// 🔧 Bug #144 修复:安全访问 priceList,防止 orderDetailInfos 为空时出错
|
// 🔧 Bug #144 修复:安全访问 priceList,防止 orderDetailInfos 为空时出错
|
||||||
|
|||||||
@@ -636,12 +636,11 @@ function getList() {
|
|||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
surgeryList.value = res.data?.records || []
|
surgeryList.value = res.data?.records || []
|
||||||
} else {
|
} else {
|
||||||
proxy.$modal.msgError(res.msg || '数据加载失败,请稍后重试')
|
console.warn('手术列表加载失败(可能无权限或数据异常):', res.msg)
|
||||||
surgeryList.value = []
|
surgeryList.value = []
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.error('获取手术列表失败:', error)
|
console.warn('手术列表请求异常:', error)
|
||||||
proxy.$modal.msgError('数据加载失败,请稍后重试')
|
|
||||||
surgeryList.value = []
|
surgeryList.value = []
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
@@ -1142,7 +1141,8 @@ function submitForm() {
|
|||||||
// 保存麻醉方式
|
// 保存麻醉方式
|
||||||
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
|
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
|
||||||
open.value = false
|
open.value = false
|
||||||
emit('saved') // 通知父组件刷新医嘱列表及手术申请列表
|
// 由父组件 @saved 事件负责刷新列表(带延迟确保后端事务已提交)
|
||||||
|
emit('saved')
|
||||||
} else {
|
} else {
|
||||||
proxy.$modal.msgError(res.msg || '新增手术失败,请检查表单信息')
|
proxy.$modal.msgError(res.msg || '新增手术失败,请检查表单信息')
|
||||||
}
|
}
|
||||||
@@ -1158,7 +1158,8 @@ function submitForm() {
|
|||||||
// 保存麻醉方式
|
// 保存麻醉方式
|
||||||
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
|
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
|
||||||
open.value = false
|
open.value = false
|
||||||
emit('saved') // 通知父组件刷新医嘱列表及手术申请列表
|
// 由父组件 @saved 事件负责刷新列表
|
||||||
|
emit('saved')
|
||||||
} else {
|
} else {
|
||||||
proxy.$modal.msgError(res.msg || '更新手术失败,请检查表单信息')
|
proxy.$modal.msgError(res.msg || '更新手术失败,请检查表单信息')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,7 +153,7 @@
|
|||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="手术申请" name="surgery">
|
<el-tab-pane label="手术申请" name="surgery">
|
||||||
<surgeryApplication :patientInfo="patientInfo" :activeTab="activeTab" ref="surgeryRef"
|
<surgeryApplication :patientInfo="patientInfo" :activeTab="activeTab" ref="surgeryRef"
|
||||||
@saved="() => { prescriptionRef?.getListInfo(); surgeryRef?.getList() }" />
|
@saved="() => { prescriptionRef?.getListInfo(); setTimeout(() => surgeryRef?.getList(), 500) }" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="电子处方" name="eprescription">
|
<el-tab-pane label="电子处方" name="eprescription">
|
||||||
<eprescriptionlist :patientInfo="patientInfo" ref="eprescriptionRef" />
|
<eprescriptionlist :patientInfo="patientInfo" ref="eprescriptionRef" />
|
||||||
|
|||||||
@@ -86,7 +86,11 @@
|
|||||||
</template>
|
</template>
|
||||||
<el-table-column type="index" label="序号" width="60" align="center" />
|
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||||
<el-table-column prop="patientName" label="患者姓名" width="120" />
|
<el-table-column prop="patientName" label="患者姓名" width="120" />
|
||||||
<el-table-column prop="name" label="申请单名称" width="140" />
|
<el-table-column label="申请单名称" width="140">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ buildApplicationName(scope.row) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column prop="createTime" label="创建时间" width="160" />
|
<el-table-column prop="createTime" label="创建时间" width="160" />
|
||||||
<el-table-column prop="prescriptionNo" label="申请单号" width="140" />
|
<el-table-column prop="prescriptionNo" label="申请单号" width="140" />
|
||||||
<el-table-column prop="requesterId_dictText" label="申请者" width="120" />
|
<el-table-column prop="requesterId_dictText" label="申请者" width="120" />
|
||||||
@@ -429,6 +433,23 @@ const parseStatus = (status) => {
|
|||||||
return statusMap[String(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 - 状态码
|
* @param {string|number} status - 状态码
|
||||||
@@ -513,6 +534,30 @@ const findTreeItem = (list, id) => {
|
|||||||
return null;
|
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) => {
|
const handleViewDetail = async (row) => {
|
||||||
// 确保科室数据已加载,以便将 ID 解析为名称
|
// 确保科室数据已加载,以便将 ID 解析为名称
|
||||||
if (!orgOptions.value || orgOptions.value.length === 0) {
|
if (!orgOptions.value || orgOptions.value.length === 0) {
|
||||||
@@ -526,8 +571,7 @@ const handleViewDetail = async (row) => {
|
|||||||
const obj = JSON.parse(row.descJson);
|
const obj = JSON.parse(row.descJson);
|
||||||
// 将发往科室 ID 转换为名称
|
// 将发往科室 ID 转换为名称
|
||||||
if (obj.targetDepartment) {
|
if (obj.targetDepartment) {
|
||||||
const deptItem = findTreeItem(orgOptions.value, obj.targetDepartment);
|
obj.targetDepartment = recursionFun(obj.targetDepartment);
|
||||||
obj.targetDepartment = deptItem ? deptItem.name : obj.targetDepartment;
|
|
||||||
}
|
}
|
||||||
descJsonData.value = obj;
|
descJsonData.value = obj;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -183,6 +183,26 @@
|
|||||||
<el-button @click="detailDialogVisible = false">关闭</el-button>
|
<el-button @click="detailDialogVisible = false">关闭</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -192,12 +212,17 @@ import {Refresh, Search} from '@element-plus/icons-vue';
|
|||||||
import {patientInfo} from '../../store/patient.js';
|
import {patientInfo} from '../../store/patient.js';
|
||||||
import {getInspection, deleteRequestForm, withdrawRequestForm} from './api';
|
import {getInspection, deleteRequestForm, withdrawRequestForm} from './api';
|
||||||
import {getDepartmentList} from '@/api/public.js';
|
import {getDepartmentList} from '@/api/public.js';
|
||||||
|
import LaboratoryTests from '../order/applicationForm/laboratoryTests.vue';
|
||||||
|
import {saveInspection} from '../order/applicationForm/api.js';
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
|
|
||||||
const tableData = ref([]);
|
const tableData = ref([]);
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const detailDialogVisible = ref(false);
|
const detailDialogVisible = ref(false);
|
||||||
|
const editDialogVisible = ref(false);
|
||||||
|
const editRowData = ref(null);
|
||||||
|
const editFormRef = ref(null);
|
||||||
const currentDetail = ref(null);
|
const currentDetail = ref(null);
|
||||||
const descJsonData = ref(null);
|
const descJsonData = ref(null);
|
||||||
const orgOptions = ref([]);
|
const orgOptions = ref([]);
|
||||||
@@ -433,10 +458,32 @@ const handleViewDetail = async (row) => {
|
|||||||
/**
|
/**
|
||||||
* 修改检验申请单(待签发状态)
|
* 修改检验申请单(待签发状态)
|
||||||
*/
|
*/
|
||||||
const handleEdit = (row) => {
|
const handleEdit = async (row) => {
|
||||||
// 复用详情查看逻辑,后续可扩展为打开编辑弹窗
|
// 确保科室数据已加载
|
||||||
handleViewDetail(row);
|
if (!orgOptions.value || orgOptions.value.length === 0) {
|
||||||
proxy.$modal?.msgInfo?.('修改功能待接入,请通过详情弹窗查看后重新开立');
|
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();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -450,7 +497,7 @@ const handleDelete = async (row) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await deleteRequestForm({ prescriptionNo: row.prescriptionNo });
|
const res = await deleteRequestForm({ requestFormId: row.requestFormId });
|
||||||
if (res?.code === 200) {
|
if (res?.code === 200) {
|
||||||
proxy.$modal?.msgSuccess?.('删除成功');
|
proxy.$modal?.msgSuccess?.('删除成功');
|
||||||
await fetchData();
|
await fetchData();
|
||||||
@@ -473,7 +520,7 @@ const handleWithdraw = async (row) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await withdrawRequestForm({ prescriptionNo: row.prescriptionNo });
|
const res = await withdrawRequestForm({ requestFormId: row.requestFormId });
|
||||||
if (res?.code === 200) {
|
if (res?.code === 200) {
|
||||||
proxy.$modal?.msgSuccess?.('撤回成功');
|
proxy.$modal?.msgSuccess?.('撤回成功');
|
||||||
await fetchData();
|
await fetchData();
|
||||||
|
|||||||
@@ -289,43 +289,62 @@ function getList() {
|
|||||||
return obj;
|
return obj;
|
||||||
});
|
});
|
||||||
form.value.diagnosisList = datas;
|
form.value.diagnosisList = datas;
|
||||||
// form.value.diagnosisList = res.data;
|
// 去重:按 conditionId 去重,防止后端重复插入导致重复记录
|
||||||
|
deduplicateDiagnosisList();
|
||||||
emits('diagnosisSave', false);
|
emits('diagnosisSave', false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
getTcmDiagnosis({ encounterId: props.patientInfo.encounterId }).then((res) => {
|
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.code == 200 && res.data?.illness?.length > 0) {
|
||||||
if (res.data.illness.length > 0) {
|
diagnosisNetDatas.value = res.data.illness;
|
||||||
diagnosisNetDatas.value = res.data.illness;
|
res.data.illness.forEach((item, index) => {
|
||||||
res.data.illness.forEach((item, index) => {
|
newList.push({
|
||||||
newList.push({
|
name: item.name + '-' + (res.data.symptom?.[index]?.name || ''),
|
||||||
name: item.name + '-' + (res.data.symptom[index]?.name || ''),
|
ybNo: item.ybNo,
|
||||||
ybNo: item.ybNo,
|
medTypeCode: item.medTypeCode,
|
||||||
medTypeCode: item.medTypeCode,
|
diagnosisDoctor: props.patientInfo.practitionerName || props.patientInfo.doctorName || props.patientInfo.physicianName || userStore.name,
|
||||||
diagnosisDoctor: props.patientInfo.practitionerName || props.patientInfo.doctorName || props.patientInfo.physicianName || userStore.name,
|
diagnosisTime: new Date().toLocaleString('zh-CN')
|
||||||
diagnosisTime: new Date().toLocaleString('zh-CN')
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// 将新数据添加到现有列表中
|
// 将新数据添加到现有列表中
|
||||||
form.value.diagnosisList.push(...newList);
|
form.value.diagnosisList.push(...newList);
|
||||||
|
|
||||||
// 重新排序整个列表
|
// 重新排序整个列表
|
||||||
form.value.diagnosisList.sort((a, b) => {
|
form.value.diagnosisList.sort((a, b) => {
|
||||||
const aNo = typeof a.diagSrtNo === 'number' ? a.diagSrtNo : 9999;
|
const aNo = typeof a.diagSrtNo === 'number' ? a.diagSrtNo : 9999;
|
||||||
const bNo = typeof b.diagSrtNo === 'number' ? b.diagSrtNo : 9999;
|
const bNo = typeof b.diagSrtNo === 'number' ? b.diagSrtNo : 9999;
|
||||||
return aNo - bNo;
|
return aNo - bNo;
|
||||||
});
|
});
|
||||||
}
|
// TCM 数据添加后也去重
|
||||||
emits('diagnosisSave', false);
|
deduplicateDiagnosisList();
|
||||||
}
|
}
|
||||||
|
emits('diagnosisSave', false);
|
||||||
});
|
});
|
||||||
|
|
||||||
getTree();
|
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();
|
init();
|
||||||
function init() {
|
function init() {
|
||||||
diagnosisInit().then((res) => {
|
diagnosisInit().then((res) => {
|
||||||
@@ -603,6 +622,18 @@ function handleSaveDiagnosis() {
|
|||||||
return aNo - bNo;
|
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开始)
|
// 步骤2:重新分配连续的序号(从1开始)
|
||||||
sortedList.forEach((item, index) => {
|
sortedList.forEach((item, index) => {
|
||||||
item.diagSrtNo = index + 1; // 这里是关键!把”诊断排序”改成新顺序
|
item.diagSrtNo = index + 1; // 这里是关键!把”诊断排序”改成新顺序
|
||||||
|
|||||||
@@ -155,7 +155,13 @@ const findTreeItem = (list, id) => {
|
|||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
const emits = defineEmits(['submitOk']);
|
const emits = defineEmits(['submitOk']);
|
||||||
const props = defineProps({});
|
const props = defineProps({
|
||||||
|
editData: {
|
||||||
|
type: Object,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const isEditMode = computed(() => !!props.editData?.requestFormId);
|
||||||
const state = reactive({});
|
const state = reactive({});
|
||||||
const applicationListAll = ref([]);
|
const applicationListAll = ref([]);
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
@@ -319,7 +325,12 @@ const projectWithDepartment = (selectProjectIds, type) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (findItem && isRelease) {
|
if (findItem && isRelease) {
|
||||||
form.targetDepartment = findItem.id;
|
// 提交时若用户已选「发往科室」,不得用项目默认执行科室覆盖
|
||||||
|
if (type === 2 && manualDept) {
|
||||||
|
form.targetDepartment = manualDept;
|
||||||
|
} else {
|
||||||
|
form.targetDepartment = findItem.id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return isRelease;
|
return isRelease;
|
||||||
@@ -331,6 +342,44 @@ watch(
|
|||||||
projectWithDepartment(newValue, 1);
|
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 = () => {
|
const submit = () => {
|
||||||
if (transferValue.value.length == 0) {
|
if (transferValue.value.length == 0) {
|
||||||
return proxy.$message.error('请选择申请单');
|
return proxy.$message.error('请选择申请单');
|
||||||
@@ -348,7 +397,7 @@ const submit = () => {
|
|||||||
unitCode: item.priceList[0].unitCode /** 请求单位编码 */,
|
unitCode: item.priceList[0].unitCode /** 请求单位编码 */,
|
||||||
unitPrice: item.priceList[0].price /** 单价 */,
|
unitPrice: item.priceList[0].price /** 单价 */,
|
||||||
totalPrice: item.priceList[0].price /** 总价 */,
|
totalPrice: item.priceList[0].price /** 总价 */,
|
||||||
positionId: item.positionId || form.targetDepartment, //执行科室id,未配置时使用用户手动选择的科室
|
positionId: form.targetDepartment || item.positionId, // 用户指定发往科室优先于项目默认执行科室
|
||||||
ybClassEnum: item.ybClassEnum, //类别医保编码
|
ybClassEnum: item.ybClassEnum, //类别医保编码
|
||||||
conditionId: item.conditionId, //诊断ID
|
conditionId: item.conditionId, //诊断ID
|
||||||
encounterDiagnosisId: item.encounterDiagnosisId, //就诊诊断id
|
encounterDiagnosisId: item.encounterDiagnosisId, //就诊诊断id
|
||||||
@@ -363,14 +412,14 @@ const submit = () => {
|
|||||||
patientId: patientInfo.value.patientId, //患者ID
|
patientId: patientInfo.value.patientId, //患者ID
|
||||||
encounterId: patientInfo.value.encounterId, // 就诊ID
|
encounterId: patientInfo.value.encounterId, // 就诊ID
|
||||||
organizationId: patientInfo.value.inHospitalOrgId, // 医疗机构ID
|
organizationId: patientInfo.value.inHospitalOrgId, // 医疗机构ID
|
||||||
requestFormId: '', // 申请单ID
|
requestFormId: isEditMode.value ? props.editData.requestFormId : '', // 申请单ID(编辑模式传入,新增为空)
|
||||||
name: '检验申请单',
|
name: '检验申请单',
|
||||||
descJson: JSON.stringify(form),
|
descJson: JSON.stringify(form),
|
||||||
categoryEnum: '21', // 21 检验 22 检查 23 输血 24 手术(避开 adviceType 1-6 碰撞)
|
categoryEnum: '21', // 21 检验 22 检查 23 输血 24 手术(避开 adviceType 1-6 碰撞)
|
||||||
};
|
};
|
||||||
saveInspection(params).then((res) => {
|
saveInspection(params).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
proxy.$message.success(res.msg);
|
proxy.$message.success(isEditMode.value ? '修改成功' : res.msg);
|
||||||
transferValue.value = [];
|
transferValue.value = [];
|
||||||
emits('submitOk');
|
emits('submitOk');
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -545,6 +545,7 @@ const submit = () => {
|
|||||||
applicationListAllFilter = applicationListAllFilter.map((item) => {
|
applicationListAllFilter = applicationListAllFilter.map((item) => {
|
||||||
return {
|
return {
|
||||||
adviceDefinitionId: item.adviceDefinitionId,
|
adviceDefinitionId: item.adviceDefinitionId,
|
||||||
|
adviceName: item.adviceName,
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
unitCode: item.priceList[0].unitCode,
|
unitCode: item.priceList[0].unitCode,
|
||||||
unitPrice: item.priceList[0].price,
|
unitPrice: item.priceList[0].price,
|
||||||
|
|||||||
@@ -1503,16 +1503,16 @@ function handleSaveBatch() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setValue(row) {
|
function setValue(row) {
|
||||||
// 构造单位列表
|
// 构造单位列表,确保 value 始终为 String 类型,避免 el-select 值类型不匹配
|
||||||
unitCodeList.value = [
|
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,
|
label: row.doseUnitCode_dictText,
|
||||||
type: 'dose',
|
type: 'dose',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: row.minUnitCode,
|
value: String(row.minUnitCode ?? ''),
|
||||||
label: row.minUnitCode_dictText,
|
label: row.minUnitCode_dictText,
|
||||||
type: 'minUnit',
|
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 || ''),
|
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
|
// dose: undefined, Removed to preserve dose value from group package
|
||||||
unitCodeList: unitCodeList.value,
|
unitCodeList: unitCodeList.value,
|
||||||
doseUnitCode: row.doseUnitCode,
|
doseUnitCode: String(row.doseUnitCode ?? ''),
|
||||||
minUnitCode: row.minUnitCode,
|
minUnitCode: String(row.minUnitCode ?? ''),
|
||||||
unitCode: row.partAttributeEnum == 1 ? row.minUnitCode : row.unitCode,
|
unitCode: row.partAttributeEnum == 1 ? String(row.minUnitCode ?? '') : String(row.unitCode ?? ''),
|
||||||
categoryEnum: row.categoryCode,
|
categoryEnum: row.categoryCode,
|
||||||
definitionId: row.chargeItemDefinitionId,
|
definitionId: row.chargeItemDefinitionId,
|
||||||
executeNum: 1,
|
executeNum: 1,
|
||||||
@@ -1595,6 +1595,10 @@ function setValue(row) {
|
|||||||
? new Decimal(selectedStock.price).div(row.partPercent).toFixed(6)
|
? new Decimal(selectedStock.price).div(row.partPercent).toFixed(6)
|
||||||
: prevRow.minUnitPrice,
|
: prevRow.minUnitPrice,
|
||||||
positionName: selectedStock?.locationName,
|
positionName: selectedStock?.locationName,
|
||||||
|
// 🔧 Bug #523 修复:初始化 totalPrice 为 0,避免总金额列显示为横杠
|
||||||
|
totalPrice: row.quantity
|
||||||
|
? new Decimal(row.quantity).mul(selectedStock?.price ?? 0).toFixed(6)
|
||||||
|
: '0',
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
|
|||||||
@@ -19,11 +19,9 @@
|
|||||||
<el-tab-pane label="检验申请" name="test">
|
<el-tab-pane label="检验申请" name="test">
|
||||||
<TestApplication ref="testApplicationRef" :show-status-column="true" />
|
<TestApplication ref="testApplicationRef" :show-status-column="true" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
```vue
|
|
||||||
<el-tab-pane label="检查申请" name="examine">
|
<el-tab-pane label="检查申请" name="examine">
|
||||||
<ExamineApplication ref="examineApplicationRef" />
|
<ExamineApplication ref="examineApplicationRef" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
```
|
|
||||||
<el-tab-pane label="汇总发药申请" name="summaryDrug">
|
<el-tab-pane label="汇总发药申请" name="summaryDrug">
|
||||||
<SummaryDrugApplication ref="summaryDrugApplicationRef" />
|
<SummaryDrugApplication ref="summaryDrugApplicationRef" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
@@ -49,6 +47,7 @@
|
|||||||
import {computed, onBeforeMount, onMounted, provide, reactive, ref, watch,} from 'vue';
|
import {computed, onBeforeMount, onMounted, provide, reactive, ref, watch,} from 'vue';
|
||||||
|
|
||||||
import Emr from './emr/index.vue';
|
import Emr from './emr/index.vue';
|
||||||
|
import SummaryDrugApplication from './components/applicationShow/summaryDrugApplication.vue';
|
||||||
import inPatientBarDoctorFold from '@/components/patientBar/inPatientBarDoctorFold.vue';
|
import inPatientBarDoctorFold from '@/components/patientBar/inPatientBarDoctorFold.vue';
|
||||||
import PatientList from '@/components/PatientList/patient-list.vue';
|
import PatientList from '@/components/PatientList/patient-list.vue';
|
||||||
import {localPatientInfo, updateLocalPatientInfo} from './store/localPatient';
|
import {localPatientInfo, updateLocalPatientInfo} from './store/localPatient';
|
||||||
@@ -84,6 +83,7 @@ const currentPatientInfo = ref({});
|
|||||||
const testApplicationRef = ref();
|
const testApplicationRef = ref();
|
||||||
const examineApplicationRef = ref();
|
const examineApplicationRef = ref();
|
||||||
const surgeryApplicationRef = ref();
|
const surgeryApplicationRef = ref();
|
||||||
|
const summaryDrugApplicationRef = ref();
|
||||||
const bloodTtransfusionAapplicationRef = ref();
|
const bloodTtransfusionAapplicationRef = ref();
|
||||||
|
|
||||||
// 患者列表相关逻辑
|
// 患者列表相关逻辑
|
||||||
|
|||||||
@@ -251,7 +251,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<!-- 划价组套选择对话框 -->
|
<!-- 划价组套选择对话框 -->
|
||||||
<el-dialog v-model="groupSetDialogVisible" title="划价组套选择" width="600px" :close-on-click-modal="false" append-to-body>
|
<el-dialog v-model="groupSetDialogVisible" title="划价组套选择" width="600px" :close-on-click-modal="false" append-to-body :z-index="3000">
|
||||||
<div style="margin-bottom: 15px; display: flex; align-items: center; gap: 10px">
|
<div style="margin-bottom: 15px; display: flex; align-items: center; gap: 10px">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="groupSetSearchText"
|
v-model="groupSetSearchText"
|
||||||
@@ -606,21 +606,26 @@ function getItemType_Text(type) {
|
|||||||
return map[type] || '其他';
|
return map[type] || '其他';
|
||||||
}
|
}
|
||||||
function getUnitCodeOptions(row) {
|
function getUnitCodeOptions(row) {
|
||||||
const unitCodes = [
|
const unitCodes = [];
|
||||||
{ code: row.unitCode != null ? String(row.unitCode) : null, codeText: row.unitCode_dictText },
|
// 大单位:优先用 code,code 缺失时用字典文本兜底
|
||||||
{ code: row.minUnitCode != null ? String(row.minUnitCode) : null, codeText: row.minUnitCode_dictText },
|
if (row.unitCode != null && String(row.unitCode) !== '') {
|
||||||
];
|
unitCodes.push({ code: String(row.unitCode), codeText: row.unitCode_dictText });
|
||||||
// 过滤掉 code 为空的单位选项
|
} else if (row.unitCode_dictText) {
|
||||||
const validUnitCodes = unitCodes.filter(item => item.code != null && item.code !== '');
|
unitCodes.push({ code: row.unitCode_dictText, codeText: row.unitCode_dictText });
|
||||||
// 使用 Set 来跟踪已经存在的 code
|
}
|
||||||
|
// 小单位:同上
|
||||||
|
if (row.minUnitCode != null && String(row.minUnitCode) !== '') {
|
||||||
|
unitCodes.push({ code: String(row.minUnitCode), codeText: row.minUnitCode_dictText });
|
||||||
|
} else if (row.minUnitCode_dictText) {
|
||||||
|
unitCodes.push({ code: row.minUnitCode_dictText, codeText: row.minUnitCode_dictText });
|
||||||
|
}
|
||||||
|
// 去重
|
||||||
const seenCodes = new Set();
|
const seenCodes = new Set();
|
||||||
const uniqueUnitCodes = validUnitCodes.filter((item) => {
|
const uniqueUnitCodes = unitCodes.filter((item) => {
|
||||||
// 如果 Set 中没有这个 code,就保留它,并把它加入 Set
|
|
||||||
if (!seenCodes.has(item.code)) {
|
if (!seenCodes.has(item.code)) {
|
||||||
seenCodes.add(item.code);
|
seenCodes.add(item.code);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// 如果已经存在,就过滤掉
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
return uniqueUnitCodes;
|
return uniqueUnitCodes;
|
||||||
|
|||||||
@@ -463,20 +463,45 @@ function watchPatientSelection() {
|
|||||||
}, 300);
|
}, 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 查询科室 */
|
/** 查询科室(支持树形/扁平多种响应结构) */
|
||||||
const getLocationInfo = () => {
|
const getLocationInfo = () => {
|
||||||
getOrgList().then((res) => {
|
getOrgList().then((res) => {
|
||||||
orgOptions.value = res.data?.records[0]?.children;
|
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 = [];
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
getLocationInfo();
|
getLocationInfo();
|
||||||
|
|
||||||
// 映射
|
// 映射(查找失败时返回 '-' 而非显示内码)
|
||||||
const selectOrg = (itemid) => {
|
const selectOrg = (itemid) => {
|
||||||
|
if (!itemid) return '-';
|
||||||
const item = orgOptions.value.find((item) => {
|
const item = orgOptions.value.find((item) => {
|
||||||
return item.id == itemid;
|
return item.id == itemid;
|
||||||
});
|
});
|
||||||
return item?.name;
|
return item?.name || '-';
|
||||||
};
|
};
|
||||||
// 重置
|
// 重置
|
||||||
const onReset = () => {
|
const onReset = () => {
|
||||||
|
|||||||
@@ -1057,8 +1057,8 @@ function confirmCharge() {
|
|||||||
params.recordingDate = formData.value.recordingDate || moment(new Date()).format('YYYY-MM-DD');
|
params.recordingDate = formData.value.recordingDate || moment(new Date()).format('YYYY-MM-DD');
|
||||||
|
|
||||||
addVitalSigns(params).then(res => {
|
addVitalSigns(params).then(res => {
|
||||||
console.log('保存成功:', res);
|
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
|
proxy.msgSuccess('保存成功');
|
||||||
// 保存成功后刷新列表
|
// 保存成功后刷新列表
|
||||||
getPatientList();
|
getPatientList();
|
||||||
// 清空表单
|
// 清空表单
|
||||||
@@ -1087,8 +1087,6 @@ function confirmCharge() {
|
|||||||
urineVolume: '',
|
urineVolume: '',
|
||||||
stoolVolume: '',
|
stoolVolume: '',
|
||||||
};
|
};
|
||||||
// 保存成功后关闭弹窗
|
|
||||||
closeDialog();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -534,6 +534,7 @@ const userStore = useUserStore();
|
|||||||
const openTraceNoDialog = ref(false)
|
const openTraceNoDialog = ref(false)
|
||||||
const rowData = ref({})
|
const rowData = ref({})
|
||||||
const ypName = ref('')
|
const ypName = ref('')
|
||||||
|
const currentIndex = ref(-1)
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const { warehous_type, category_code, service_type_code, specialty_code, purchase_type } =
|
const { warehous_type, category_code, service_type_code, specialty_code, purchase_type } =
|
||||||
@@ -1072,13 +1073,6 @@ function onHeaderWarehouseChange() {
|
|||||||
|
|
||||||
// 选择仓库 / 选药品后拉取该仓库存
|
// 选择仓库 / 选药品后拉取该仓库存
|
||||||
function handleLocationClick(item, row, index) {
|
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];
|
const r = form.purchaseinventoryList[index];
|
||||||
let orgLocationId = r.sourceLocationId || receiptHeaderForm.headerLocationId || '';
|
let orgLocationId = r.sourceLocationId || receiptHeaderForm.headerLocationId || '';
|
||||||
if (!orgLocationId) {
|
if (!orgLocationId) {
|
||||||
@@ -1137,15 +1131,15 @@ function handleLocationClick(item, row, index) {
|
|||||||
.then((res) => {
|
.then((res) => {
|
||||||
const list = res.data || [];
|
const list = res.data || [];
|
||||||
const d = pickBestOrgQuantityRow(list);
|
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);
|
applyFromDto(d, false);
|
||||||
if (Number(r.totalQuantity) <= 0) {
|
|
||||||
proxy.$message.warning('仓库数量为0,无法调用!');
|
|
||||||
}
|
|
||||||
persistStore();
|
persistStore();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 严格查询无库存或数量为0 → 回退到非严格查询(查同仓库其他批号)
|
||||||
if (lotTrimmed) {
|
if (lotTrimmed) {
|
||||||
return runGet(false).then((res2) => {
|
return runGet(false).then((res2) => {
|
||||||
const list2 = res2.data || [];
|
const list2 = res2.data || [];
|
||||||
@@ -1163,6 +1157,8 @@ function handleLocationClick(item, row, index) {
|
|||||||
persistStore();
|
persistStore();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 没有指定批号,直接提示
|
||||||
r.totalQuantity = 0;
|
r.totalQuantity = 0;
|
||||||
r.price = 0;
|
r.price = 0;
|
||||||
proxy.$message.warning('仓库数量为0,无法调用!');
|
proxy.$message.warning('仓库数量为0,无法调用!');
|
||||||
@@ -1481,7 +1477,7 @@ function handleScan(row,index){
|
|||||||
rowData.value = row
|
rowData.value = row
|
||||||
rowData.value.itemType = receiptHeaderForm.medicationType
|
rowData.value.itemType = receiptHeaderForm.medicationType
|
||||||
ypName.value = row.name
|
ypName.value = row.name
|
||||||
openTraceNoDialog .value = true;
|
openTraceNoDialog.value = true;
|
||||||
currentIndex.value = index
|
currentIndex.value = index
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1704,6 +1700,17 @@ const exportRequiredParams = ref({
|
|||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
busNo: route.query.supplyBusNo
|
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() {
|
function handleExport() {
|
||||||
proxy.downloadGet(
|
proxy.downloadGet(
|
||||||
'/issue-manage/requisition/excel-out',
|
'/issue-manage/requisition/excel-out',
|
||||||
|
|||||||
@@ -1535,8 +1535,8 @@ function handleMedicalAdvice(row) {
|
|||||||
temporarySigned.value = hasSubmittedAdvices; // 修复:根据已有数据状态设置,而非盲目重置
|
temporarySigned.value = hasSubmittedAdvices; // 修复:根据已有数据状态设置,而非盲目重置
|
||||||
temporaryMedicalLoading.value = true // 🔧 新增:开始加载
|
temporaryMedicalLoading.value = true // 🔧 新增:开始加载
|
||||||
|
|
||||||
// 调用计费接口获取数据
|
// 调用计费接口获取数据(使用手术计费来源参数,匹配 surgery billing 创建的记录)
|
||||||
getPrescriptionList(row.visitId).then((res) => {
|
getPrescriptionList(row.visitId, 6, row.operCode).then((res) => {
|
||||||
console.log('=== 拉取计费数据返回结果 ===', res)
|
console.log('=== 拉取计费数据返回结果 ===', res)
|
||||||
if (res.code === 200 && res.data) {
|
if (res.code === 200 && res.data) {
|
||||||
// 🔧 修复:显示所有药品请求数据,不管有没有计费项目
|
// 🔧 修复:显示所有药品请求数据,不管有没有计费项目
|
||||||
@@ -1741,27 +1741,39 @@ function handleTemporaryMedicalSubmit(data) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// 🔧 修复 Bug #445: 使用稳定的字段组合匹配已提交项目,而不是依赖可能为空的 requestId/chargeItemId
|
// 🔧 修复 Bug #445: 使用稳定可靠的字段组合匹配已提交项目,从已生成列表中剔除待生成项
|
||||||
// 构建已提交项目的匹配键集合(药品名称 + 规格 + 数量)
|
// 匹配键:优先使用 chargeItemId(后端费用项目ID,最可靠),其次使用 名称+规格+数量 组合
|
||||||
const submittedKeys = new Set(
|
const submittedKeys = new Set()
|
||||||
(data.temporaryAdvices || [])
|
const submittedChargeIds = new Set()
|
||||||
.map(a => {
|
|
||||||
const om = a.originalMedicine || {}
|
|
||||||
const name = om.medicineName || om.adviceName || om.advice_name || a.adviceName || ''
|
|
||||||
const spec = om.specification || om.volume || ''
|
|
||||||
const qty = om.quantity || 0
|
|
||||||
return `${name}|||${spec}|||${qty}`
|
|
||||||
})
|
|
||||||
.filter(k => k !== '|||0') // 过滤掉空项
|
|
||||||
)
|
|
||||||
|
|
||||||
if (submittedKeys.size > 0) {
|
;(data.temporaryAdvices || []).forEach(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}`)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if (submittedChargeIds.size > 0 || submittedKeys.size > 0) {
|
||||||
temporaryBillingMedicines.value = (temporaryBillingMedicines.value || []).filter(m => {
|
temporaryBillingMedicines.value = (temporaryBillingMedicines.value || []).filter(m => {
|
||||||
const key = `${m.medicineName || ''}|||${m.specification || ''}|||${m.quantity || 0}`
|
// 优先用 chargeItemId 匹配
|
||||||
|
if (m.chargeItemId && submittedChargeIds.has(m.chargeItemId)) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
// 兜底用 名称+规格+数量 匹配
|
||||||
|
const key = `${m.medicineName || m.adviceName || ''}|||${m.specification || m.volume || ''}|||${m.quantity || 0}`
|
||||||
return !submittedKeys.has(key)
|
return !submittedKeys.has(key)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// 如果没有任何匹配键,清空待生成列表(所有项目都已提交)
|
// 如果没有任何匹配标识,清空待生成列表(保守策略:认为所有项目都已提交)
|
||||||
temporaryBillingMedicines.value = []
|
temporaryBillingMedicines.value = []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user