Compare commits
42 Commits
bugfix/518
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12d0733c0c | ||
|
|
610fff704a | ||
|
|
0aa7dd9b82 | ||
|
|
5946c1ea4b | ||
|
|
8d905c9844 | ||
|
|
49fc905316 | ||
|
|
3ee09b22c7 | ||
|
|
6b4f897b9c | ||
|
|
848a55cf23 | ||
|
|
4ae4421827 | ||
|
|
4138dc39f6 | ||
|
|
718e7a90c5 | ||
|
|
68c682ad49 | ||
|
|
c7368db889 | ||
|
|
e64370bb67 | ||
|
|
078439245b | ||
|
|
1124b1010d | ||
|
|
f41b86a143 | ||
|
|
d3310ade51 | ||
|
|
1dbf7859ea | ||
|
|
6940c3861d | ||
|
|
6e975bf9c4 | ||
|
|
3360cccaa5 | ||
|
|
fe138589a5 | ||
|
|
270475adb9 | ||
|
|
7d0c93b9a1 | ||
|
|
87f5135ddc | ||
|
|
e6c0d03dc1 | ||
|
|
5f7b75667a | ||
|
|
2cdda279a4 | ||
| bc595e3843 | |||
|
|
53e5ee331b | ||
|
|
4e7e79d9c0 | ||
|
|
571f254d0e | ||
|
|
560813d009 | ||
| 31c2acb4ef | |||
|
|
254de01d2e | ||
|
|
e21122edf0 | ||
|
|
e9576ddfa8 | ||
|
|
b435de9e7b | ||
|
|
bc13fd6968 | ||
|
|
d9ad63397b |
@@ -1,10 +0,0 @@
|
|||||||
#!/usr/bin/env sh
|
|
||||||
# ============================================================
|
|
||||||
# Husky Pre-commit Hook - HIS项目
|
|
||||||
# 配置: 关羽 | 日期: 2026-04-24
|
|
||||||
# 功能: 提交前检查(已禁用)
|
|
||||||
# ============================================================
|
|
||||||
|
|
||||||
# 🔧 已禁用所有检查,直接允许提交
|
|
||||||
echo "⏭️ [Pre-commit] 检查已禁用,允许提交"
|
|
||||||
exit 0
|
|
||||||
@@ -5,6 +5,7 @@ import com.core.common.core.domain.R;
|
|||||||
import com.openhis.web.doctorstation.dto.AdviceBaseDto;
|
import com.openhis.web.doctorstation.dto.AdviceBaseDto;
|
||||||
import com.openhis.web.doctorstation.dto.AdviceSaveParam;
|
import com.openhis.web.doctorstation.dto.AdviceSaveParam;
|
||||||
import com.openhis.web.doctorstation.dto.OrderBindInfoDto;
|
import com.openhis.web.doctorstation.dto.OrderBindInfoDto;
|
||||||
|
import com.openhis.web.doctorstation.dto.SurgeryItemDto;
|
||||||
import com.openhis.web.doctorstation.dto.UpdateGroupIdParam;
|
import com.openhis.web.doctorstation.dto.UpdateGroupIdParam;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -134,4 +135,16 @@ public interface IDoctorStationAdviceAppService {
|
|||||||
* @return 已配置的药品类别编码列表
|
* @return 已配置的药品类别编码列表
|
||||||
*/
|
*/
|
||||||
R<?> getConfiguredCategories(Long organizationId);
|
R<?> getConfiguredCategories(Long organizationId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手术项目专用分页查询(仅手术 + 定价,无库存/草稿库存/取药科室等无关逻辑)
|
||||||
|
*
|
||||||
|
* @param organizationId 科室ID(可选)
|
||||||
|
* @param pageNo 当前页
|
||||||
|
* @param pageSize 每页条数
|
||||||
|
* @param searchKey 模糊查询关键字(可选)
|
||||||
|
* @return 手术项目分页数据(含价格信息)
|
||||||
|
*/
|
||||||
|
IPage<SurgeryItemDto> getSurgeryPage(Long organizationId, Integer pageNo, Integer pageSize, String searchKey);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2440,4 +2440,20 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
|||||||
return R.ok(categoryCodes);
|
return R.ok(categoryCodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手术项目专用分页查询(仅手术 + 定价,无库存/草稿库存/取药科室等无关逻辑)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public IPage<SurgeryItemDto> getSurgeryPage(Long organizationId, Integer pageNo, Integer pageSize, String searchKey) {
|
||||||
|
log.info("getSurgeryPage 开始: orgId={}, page={}/{}, searchKey={}", organizationId, pageNo, pageSize, searchKey);
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
IPage<SurgeryItemDto> result = doctorStationAdviceAppMapper.getSurgeryPage(
|
||||||
|
new Page<>(pageNo, pageSize),
|
||||||
|
PublicationStatus.ACTIVE.getValue(),
|
||||||
|
organizationId,
|
||||||
|
searchKey);
|
||||||
|
log.info("getSurgeryPage 完成: {}ms, total={}, records={}", System.currentTimeMillis() - start, result.getTotal(), result.getRecords().size());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.*;
|
||||||
|
|
||||||
@@ -598,6 +601,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
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -203,4 +203,22 @@ public class DoctorStationAdviceController {
|
|||||||
return iDoctorStationAdviceAppService.getConfiguredCategories(organizationId);
|
return iDoctorStationAdviceAppService.getConfiguredCategories(organizationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手术项目专用分页查询(仅手术 + 定价,无库存/草稿库存/取药科室等无关逻辑)
|
||||||
|
*
|
||||||
|
* @param organizationId 科室ID(可选)
|
||||||
|
* @param pageNo 当前页
|
||||||
|
* @param pageSize 每页条数
|
||||||
|
* @param searchKey 模糊查询关键字(可选)
|
||||||
|
* @return 手术项目分页数据(含价格信息)
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/surgery-page")
|
||||||
|
public R<?> getSurgeryPage(
|
||||||
|
@RequestParam(value = "organizationId", required = false) Long organizationId,
|
||||||
|
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
|
@RequestParam(value = "pageSize", defaultValue = "500") Integer pageSize,
|
||||||
|
@RequestParam(value = "searchKey", defaultValue = "") String searchKey) {
|
||||||
|
return R.ok(iDoctorStationAdviceAppService.getSurgeryPage(organizationId, pageNo, pageSize, searchKey));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,4 +96,9 @@ public class DiagnosisQueryDto {
|
|||||||
*/
|
*/
|
||||||
private String diagnosisDoctor;
|
private String diagnosisDoctor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否已有传染病报卡(0-无,1-有)
|
||||||
|
*/
|
||||||
|
private Integer hasInfectiousReport;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.openhis.web.doctorstation.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手术项目选择器专用 DTO(不含 @Dict 注解,绕过 DictAspect 的 Redis 字典翻译)
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SurgeryItemDto {
|
||||||
|
|
||||||
|
/** 医嘱定义ID */
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long adviceDefinitionId;
|
||||||
|
|
||||||
|
/** 手术名称 */
|
||||||
|
private String adviceName;
|
||||||
|
|
||||||
|
/** 所属科室ID */
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long orgId;
|
||||||
|
|
||||||
|
/** 执行科室ID */
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long positionId;
|
||||||
|
|
||||||
|
/** 费用定价主表ID(用于提交时关联价格) */
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long chargeItemDefinitionId;
|
||||||
|
|
||||||
|
/** 单价(直接从定价主表取,无需嵌套 priceList) */
|
||||||
|
private BigDecimal price;
|
||||||
|
|
||||||
|
/** 单位编码 */
|
||||||
|
private String unitCode;
|
||||||
|
|
||||||
|
/** 单位编码字典文本(前端用于显示单位) */
|
||||||
|
private String unitCodeDictText;
|
||||||
|
}
|
||||||
@@ -185,4 +185,18 @@ public interface DoctorStationAdviceAppMapper {
|
|||||||
*/
|
*/
|
||||||
Long getDefaultAccountId(@Param("encounterId") Long encounterId);
|
Long getDefaultAccountId(@Param("encounterId") Long encounterId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手术项目专用分页查询(仅手术 + 定价,无库存/草稿库存/取药科室等无关逻辑)
|
||||||
|
*
|
||||||
|
* @param page 分页参数
|
||||||
|
* @param statusEnum 启用状态
|
||||||
|
* @param organizationId 科室ID(可选,用于过滤已配置的手术项目)
|
||||||
|
* @param searchKey 模糊查询关键字(可选)
|
||||||
|
* @return 手术项目分页数据
|
||||||
|
*/
|
||||||
|
IPage<SurgeryItemDto> getSurgeryPage(@Param("page") Page<SurgeryItemDto> page,
|
||||||
|
@Param("statusEnum") Integer statusEnum,
|
||||||
|
@Param("organizationId") Long organizationId,
|
||||||
|
@Param("searchKey") String searchKey);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ public class InpatientAdviceDto {
|
|||||||
/**
|
/**
|
||||||
* 药品/服务类型
|
* 药品/服务类型
|
||||||
*/
|
*/
|
||||||
private Integer categoryCode;
|
private String categoryCode;
|
||||||
/**
|
/**
|
||||||
* 执行科室
|
* 执行科室
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -811,4 +811,29 @@
|
|||||||
LIMIT 1
|
LIMIT 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 手术项目专用分页查询:仅查手术 + 定价,无库存/草稿库存/取药科室等无关逻辑 -->
|
||||||
|
<select id="getSurgeryPage" resultType="com.openhis.web.doctorstation.dto.SurgeryItemDto">
|
||||||
|
SELECT
|
||||||
|
t1.ID AS advice_definition_id,
|
||||||
|
t1.NAME AS advice_name,
|
||||||
|
t1.org_id AS org_id,
|
||||||
|
t1.org_id AS position_id,
|
||||||
|
t2.ID AS charge_item_definition_id,
|
||||||
|
t2.price AS price,
|
||||||
|
t1.permitted_unit_code AS unit_code,
|
||||||
|
t1.permitted_unit_code AS unit_code_dict_text
|
||||||
|
FROM wor_activity_definition t1
|
||||||
|
LEFT JOIN adm_charge_item_definition t2
|
||||||
|
ON t2.instance_id = t1.ID
|
||||||
|
AND t2.delete_flag = '0'
|
||||||
|
AND t2.status_enum = #{statusEnum}
|
||||||
|
AND t2.instance_table = 'wor_activity_definition'
|
||||||
|
WHERE t1.delete_flag = '0'
|
||||||
|
AND (t1.category_code = '手术' OR t1.category_code = '24')
|
||||||
|
<if test="searchKey != null and searchKey != ''">
|
||||||
|
AND (t1.name ILIKE '%' || #{searchKey} || '%' OR t1.py_str ILIKE '%' || #{searchKey} || '%')
|
||||||
|
</if>
|
||||||
|
ORDER BY t1.name ASC
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -305,28 +305,28 @@
|
|||||||
T1.occurrence_end_time AS end_time,
|
T1.occurrence_end_time AS end_time,
|
||||||
T1.requester_id AS requester_id,
|
T1.requester_id AS requester_id,
|
||||||
T1.create_time AS request_time,
|
T1.create_time AS request_time,
|
||||||
NULL AS skin_test_flag,
|
NULL::integer AS skin_test_flag,
|
||||||
NULL AS inject_flag,
|
NULL::integer AS inject_flag,
|
||||||
NULL AS group_id,
|
NULL::bigint AS group_id,
|
||||||
T1.performer_check_id,
|
T1.performer_check_id,
|
||||||
T2."name" AS advice_name,
|
T2."name" AS advice_name,
|
||||||
T2.id AS item_id,
|
T2.id AS item_id,
|
||||||
NULL AS volume,
|
NULL::varchar AS volume,
|
||||||
NULL AS lot_number,
|
NULL::varchar AS lot_number,
|
||||||
T1.quantity AS quantity,
|
T1.quantity AS quantity,
|
||||||
T1.unit_code AS unit_code,
|
T1.unit_code AS unit_code,
|
||||||
T1.status_enum AS request_status,
|
T1.status_enum AS request_status,
|
||||||
NULL AS method_code,
|
NULL::varchar AS method_code,
|
||||||
NULL AS rate_code,
|
NULL::varchar AS rate_code,
|
||||||
NULL AS dose,
|
NULL::numeric AS dose,
|
||||||
NULL AS dose_unit_code,
|
NULL::varchar AS dose_unit_code,
|
||||||
ao1.id AS position_id,
|
ao1.id AS position_id,
|
||||||
ao1."name" AS position_name,
|
ao1."name" AS position_name,
|
||||||
NULL AS dispense_per_duration,
|
NULL::integer AS dispense_per_duration,
|
||||||
1 AS part_percent,
|
1::numeric AS part_percent,
|
||||||
ccd."name" AS condition_definition_name,
|
ccd."name" AS condition_definition_name,
|
||||||
T1.therapy_enum AS therapy_enum,
|
T1.therapy_enum AS therapy_enum,
|
||||||
NULL AS sort_number,
|
NULL::integer AS sort_number,
|
||||||
T1.quantity AS execute_num,
|
T1.quantity AS execute_num,
|
||||||
af.day_times,
|
af.day_times,
|
||||||
ae.bus_no,
|
ae.bus_no,
|
||||||
@@ -341,7 +341,7 @@
|
|||||||
personal_account.balance_amount,
|
personal_account.balance_amount,
|
||||||
personal_account.id AS account_id,
|
personal_account.id AS account_id,
|
||||||
T2.category_code,
|
T2.category_code,
|
||||||
NULL AS dispense_status
|
NULL::integer AS dispense_status
|
||||||
FROM wor_service_request AS T1
|
FROM wor_service_request AS T1
|
||||||
LEFT JOIN wor_activity_definition AS T2
|
LEFT JOIN wor_activity_definition AS T2
|
||||||
ON T2.id = T1.activity_id
|
ON T2.id = T1.activity_id
|
||||||
|
|||||||
@@ -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),
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
try {
|
||||||
await loadPackageDetailsForItem(it);
|
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);
|
||||||
|
|||||||
@@ -1,6 +1,15 @@
|
|||||||
import request from '@/utils/request';
|
import request from '@/utils/request';
|
||||||
// 申请单相关接口
|
// 申请单相关接口
|
||||||
|
|
||||||
|
// 手术项目专用分页查询(仅手术 + 定价,无库存/草稿库存等无关逻辑)
|
||||||
|
export function getSurgeryPage(params) {
|
||||||
|
return request({
|
||||||
|
url: '/doctor-station/advice/surgery-page',
|
||||||
|
method: 'get',
|
||||||
|
params: params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//医嘱大下拉
|
//医嘱大下拉
|
||||||
export function getApplicationList(queryParams) {
|
export function getApplicationList(queryParams) {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@@ -325,9 +325,14 @@ const projectWithDepartment = (selectProjectIds, type) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (findItem && isRelease) {
|
if (findItem && isRelease) {
|
||||||
|
// 提交时若用户已选「发往科室」,不得用项目默认执行科室覆盖
|
||||||
|
if (type === 2 && manualDept) {
|
||||||
|
form.targetDepartment = manualDept;
|
||||||
|
} else {
|
||||||
form.targetDepartment = findItem.id;
|
form.targetDepartment = findItem.id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return isRelease;
|
return isRelease;
|
||||||
};
|
};
|
||||||
// 监听选择项目变化
|
// 监听选择项目变化
|
||||||
@@ -392,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
|
||||||
|
|||||||
@@ -274,7 +274,7 @@ const getList = () => {
|
|||||||
}
|
}
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
getApplicationList({
|
getApplicationList({
|
||||||
pageSize: 500,
|
pageSize: 5000,
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
categoryCode: '23',
|
categoryCode: '23',
|
||||||
organizationId: effectivePatientInfo.value.inHospitalOrgId,
|
organizationId: effectivePatientInfo.value.inHospitalOrgId,
|
||||||
@@ -542,6 +542,8 @@ const submit = () => {
|
|||||||
let applicationListAllFilter = applicationListAll.value.filter((item) => {
|
let applicationListAllFilter = applicationListAll.value.filter((item) => {
|
||||||
return transferValue.value.includes(item.adviceDefinitionId);
|
return transferValue.value.includes(item.adviceDefinitionId);
|
||||||
});
|
});
|
||||||
|
// 从原始记录中提取检查项目名称,用于申请单名称字段
|
||||||
|
const selectedNames = applicationListAllFilter.map(item => item.adviceName).join('+');
|
||||||
applicationListAllFilter = applicationListAllFilter.map((item) => {
|
applicationListAllFilter = applicationListAllFilter.map((item) => {
|
||||||
return {
|
return {
|
||||||
adviceDefinitionId: item.adviceDefinitionId,
|
adviceDefinitionId: item.adviceDefinitionId,
|
||||||
@@ -573,7 +575,7 @@ const submit = () => {
|
|||||||
encounterId: effectivePatientInfo.value.encounterId,
|
encounterId: effectivePatientInfo.value.encounterId,
|
||||||
organizationId: effectivePatientInfo.value.inHospitalOrgId,
|
organizationId: effectivePatientInfo.value.inHospitalOrgId,
|
||||||
requestFormId: requestFormId,
|
requestFormId: requestFormId,
|
||||||
name: applicationListAllFilter.map(item => item.adviceName).join('、'),
|
name: selectedNames,
|
||||||
descJson: JSON.stringify(submitForm),
|
descJson: JSON.stringify(submitForm),
|
||||||
categoryEnum: '22',
|
categoryEnum: '22',
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
|
|||||||
@@ -5,13 +5,27 @@
|
|||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
<div class="surgery-container">
|
<div class="surgery-container">
|
||||||
<div v-loading="loading" class="transfer-wrapper" style="min-height: 300px;">
|
<div class="transfer-wrapper" style="min-height: 300px;">
|
||||||
|
<!-- 搜索框:≥3字触发后端搜索 -->
|
||||||
|
<div style="padding: 6px 0;">
|
||||||
|
<el-input
|
||||||
|
v-model="searchKey"
|
||||||
|
placeholder="请输入3个字及以上搜索"
|
||||||
|
clearable
|
||||||
|
@input="onSearchInput"
|
||||||
|
style="width: 320px;"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<!-- 加载提示不阻塞穿梭框操作 -->
|
||||||
|
<div v-if="loading" style="padding:8px 0; color:#909399; font-size:13px;">
|
||||||
|
<el-icon class="is-loading"><Loading /></el-icon> 手术项目加载中...
|
||||||
|
</div>
|
||||||
<el-transfer
|
<el-transfer
|
||||||
|
ref="transferRef"
|
||||||
v-model="transferValue"
|
v-model="transferValue"
|
||||||
:data="applicationList"
|
:data="applicationList"
|
||||||
filter-placeholder="项目代码/名称"
|
:titles="['待选择', '已选择']"
|
||||||
filterable
|
:format="leftPanelFormat"
|
||||||
:titles="['未选择', '已选择']"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="bloodTransfusion-form">
|
<div class="bloodTransfusion-form">
|
||||||
@@ -78,17 +92,26 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup name="Surgery">
|
<script setup name="Surgery">
|
||||||
import {getCurrentInstance, onBeforeMount, onMounted, reactive, ref, watch} from 'vue';
|
import {computed, getCurrentInstance, onBeforeMount, onMounted, reactive, ref, watch} from 'vue';
|
||||||
import {patientInfo} from '../../../store/patient.js';
|
import {patientInfo} from '../../../store/patient.js';
|
||||||
import {getDepartmentList} from '@/api/public.js';
|
import {getDepartmentList} from '@/api/public.js';
|
||||||
import {getEncounterDiagnosis} from '../../api.js';
|
import {getEncounterDiagnosis} from '../../api.js';
|
||||||
import {getApplicationList, saveSurgery} from './api';
|
import {getSurgeryPage, saveSurgery} from './api';
|
||||||
import {ElMessage} from 'element-plus';
|
import {ElMessage} from 'element-plus';
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
// 模块级缓存:避免每次打开弹窗都重新请求手术项目列表
|
// 模块级缓存:避免每次打开弹窗都重新请求手术项目列表
|
||||||
let surgeryRecordsCache = null; // 原始 API 记录
|
let surgeryRecordsCache = null; // 原始 API 记录
|
||||||
let surgeryMappedCache = null; // 映射后的 el-transfer 数据
|
let surgeryMappedCache = null; // 映射后的 el-transfer 数据
|
||||||
|
let searchDebounceTimer = null; // 搜索防抖
|
||||||
|
const transferRef = ref(null);
|
||||||
|
const dbTotal = ref(0); // 数据库中的手术项目总数
|
||||||
|
const searchKey = ref(''); // 搜索关键字
|
||||||
|
const checkedCount = computed(() => transferValue.value.length);
|
||||||
|
const leftPanelFormat = computed(() => ({
|
||||||
|
noChecked: ` 0/${dbTotal.value}`,
|
||||||
|
hasChecked: ` \${checked}/${dbTotal.value}`,
|
||||||
|
}));
|
||||||
// 递归查找树形科室节点
|
// 递归查找树形科室节点
|
||||||
const findTreeItem = (list, id) => {
|
const findTreeItem = (list, id) => {
|
||||||
if (!list || list.length === 0) return null;
|
if (!list || list.length === 0) return null;
|
||||||
@@ -108,55 +131,82 @@ const applicationListAll = ref();
|
|||||||
const applicationList = ref();
|
const applicationList = ref();
|
||||||
const orgOptions = ref([]); // 科室选项
|
const orgOptions = ref([]); // 科室选项
|
||||||
const loading = ref(false); // 加载状态
|
const loading = ref(false); // 加载状态
|
||||||
const getList = () => {
|
const mapToTransferItem = (item) => {
|
||||||
if (!patientInfo.value?.inHospitalOrgId) {
|
const price = item.price != null ? Number(item.price).toFixed(2) : '0.00';
|
||||||
applicationList.value = [];
|
const unit = item.unitCodeDictText || item.unitCode || '';
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 命中缓存时直接使用,避免重复请求导致加载缓慢
|
|
||||||
if (surgeryMappedCache && surgeryMappedCache.length > 0) {
|
|
||||||
applicationList.value = surgeryMappedCache;
|
|
||||||
applicationListAll.value = surgeryRecordsCache;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
loading.value = true;
|
|
||||||
getApplicationList({
|
|
||||||
pageSize: 500,
|
|
||||||
pageNum: 1,
|
|
||||||
categoryCode: '24',
|
|
||||||
organizationId: patientInfo.value.inHospitalOrgId,
|
|
||||||
adviceTypes: [3, 6], //1 药品 2耗材 3诊疗 6手术
|
|
||||||
})
|
|
||||||
.then((res) => {
|
|
||||||
if (res.code === 200) {
|
|
||||||
applicationListAll.value = res.data.records;
|
|
||||||
applicationList.value = res.data.records.map((item) => {
|
|
||||||
const priceInfo = item.priceList?.[0] || {};
|
|
||||||
const price = priceInfo.price != null ? Number(priceInfo.price).toFixed(2) : '0.00';
|
|
||||||
const unit = item.unitCode_dictText || item.unitCode || '';
|
|
||||||
return {
|
return {
|
||||||
adviceDefinitionId: item.adviceDefinitionId,
|
adviceDefinitionId: item.adviceDefinitionId,
|
||||||
orgId: item.orgId,
|
orgId: item.orgId,
|
||||||
label: item.adviceName + ' (¥' + price + '/' + unit + ')',
|
label: item.adviceName + ' (¥' + price + '/' + unit + ')',
|
||||||
key: item.adviceDefinitionId,
|
key: item.adviceDefinitionId,
|
||||||
};
|
};
|
||||||
});
|
};
|
||||||
// 写入模块缓存,后续打开弹窗直接复用
|
const getList = () => {
|
||||||
surgeryRecordsCache = res.data.records;
|
if (!patientInfo.value?.inHospitalOrgId) {
|
||||||
surgeryMappedCache = applicationList.value;
|
|
||||||
} else {
|
|
||||||
console.warn('获取手术项目列表失败:', res.message);
|
|
||||||
applicationList.value = [];
|
applicationList.value = [];
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
// 命中内存缓存时直接使用
|
||||||
|
if (surgeryMappedCache && surgeryMappedCache.length > 0) {
|
||||||
|
applicationList.value = surgeryMappedCache;
|
||||||
|
applicationListAll.value = surgeryRecordsCache;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
loadPage('');
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载手术项目分页数据
|
||||||
|
* @param {string} key 搜索关键字(可选)
|
||||||
|
*/
|
||||||
|
const loadPage = (key) => {
|
||||||
|
const orgId = patientInfo.value.inHospitalOrgId;
|
||||||
|
loading.value = true;
|
||||||
|
getSurgeryPage({ organizationId: orgId, pageNo: 1, pageSize: 100, searchKey: key || '' })
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code !== 200 || !res.data?.records) {
|
||||||
|
applicationList.value = [];
|
||||||
|
dbTotal.value = 0;
|
||||||
|
loading.value = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dbTotal.value = res.data.total || 0;
|
||||||
|
const records = res.data.records;
|
||||||
|
applicationListAll.value = records;
|
||||||
|
applicationList.value = records.map(mapToTransferItem);
|
||||||
|
// 仅在无搜索时缓存
|
||||||
|
if (!key) {
|
||||||
|
surgeryRecordsCache = records;
|
||||||
|
surgeryMappedCache = applicationList.value;
|
||||||
|
}
|
||||||
|
loading.value = false;
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
console.warn('手术项目列表加载失败(可能无权限):', e?.message || e);
|
console.error('手术项目加载失败:', e);
|
||||||
applicationList.value = [];
|
applicationList.value = [];
|
||||||
})
|
dbTotal.value = 0;
|
||||||
.finally(() => {
|
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索输入框变化处理(防抖300ms,≥3字触发后端搜索)
|
||||||
|
*/
|
||||||
|
const onSearchInput = () => {
|
||||||
|
clearTimeout(searchDebounceTimer);
|
||||||
|
const val = searchKey.value.trim();
|
||||||
|
if (!val) {
|
||||||
|
// 清空搜索框,恢复初始数据
|
||||||
|
loadPage('');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (val.length >= 3) {
|
||||||
|
searchDebounceTimer = setTimeout(() => {
|
||||||
|
loadPage(val);
|
||||||
|
}, 300);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const transferValue = ref([]);
|
const transferValue = ref([]);
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
// categoryType: '', // 项目类别
|
// categoryType: '', // 项目类别
|
||||||
@@ -243,20 +293,15 @@ const submit = () => {
|
|||||||
});
|
});
|
||||||
applicationListAllFilter = applicationListAllFilter.map((item) => {
|
applicationListAllFilter = applicationListAllFilter.map((item) => {
|
||||||
return {
|
return {
|
||||||
adviceDefinitionId: item.adviceDefinitionId /** 诊疗定义id */,
|
adviceDefinitionId: item.adviceDefinitionId,
|
||||||
adviceDefinitionName: item.adviceDefinitionName /** 诊疗定义名称(手术项目名称) */,
|
adviceDefinitionName: item.adviceName,
|
||||||
quantity: 1, // /** 请求数量 */
|
quantity: 1,
|
||||||
unitCode: item.priceList[0].unitCode /** 请求单位编码 */,
|
unitCode: item.unitCode,
|
||||||
unitPrice: item.priceList[0].price /** 单价 */,
|
unitPrice: item.price,
|
||||||
totalPrice: item.priceList[0].price /** 总价 */,
|
totalPrice: item.price,
|
||||||
positionId: item.positionId, //执行科室id
|
positionId: item.positionId,
|
||||||
ybClassEnum: item.ybClassEnum, //类别医保编码
|
definitionId: item.chargeItemDefinitionId,
|
||||||
conditionId: item.conditionId, //诊断ID
|
accountId: patientInfo.value.accountId,
|
||||||
encounterDiagnosisId: item.encounterDiagnosisId, //就诊诊断id
|
|
||||||
adviceType: item.adviceType, ///** 医嘱类型 */
|
|
||||||
definitionId: item.priceList[0].definitionId, //费用定价主表ID */
|
|
||||||
definitionDetailId: item.definitionDetailId, //费用定价子表ID */
|
|
||||||
accountId: patientInfo.value.accountId, // // 账户id
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
saveSurgery({
|
saveSurgery({
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user