套餐设置功能前后端内容基本完成(细节未处理)
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
package com.openhis.lab.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 检验套餐基本信息
|
||||
*
|
||||
* @author system
|
||||
* @date 2025-12-25
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@TableName(value = "inspection_basic_information", autoResultMap = true)
|
||||
public class InspectionPackage {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 套餐ID */
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@JsonProperty("packageId") // 保持向后兼容
|
||||
private String basicInformationId;
|
||||
|
||||
/** 套餐类别,固定值:"检验套餐" */
|
||||
private String packageCategory;
|
||||
|
||||
/** 套餐级别:全院套餐/科室套餐/个人套餐 */
|
||||
private String packageLevel;
|
||||
|
||||
/** 套餐名称 */
|
||||
private String packageName;
|
||||
|
||||
/** 科室名称 */
|
||||
private String department;
|
||||
|
||||
/** 科室ID */
|
||||
private String departmentId;
|
||||
|
||||
/** 用户ID */
|
||||
private String userId;
|
||||
|
||||
/** 折扣百分比,默认0 */
|
||||
private BigDecimal discount;
|
||||
|
||||
/** 是否停用,默认false */
|
||||
@TableField("is_disabled")
|
||||
private Boolean isDisabled;
|
||||
|
||||
/** 显示套餐名,默认true */
|
||||
@TableField("show_package_name")
|
||||
private Boolean showPackageName;
|
||||
|
||||
/** 生成服务费,默认true */
|
||||
@TableField("generate_service_fee")
|
||||
private Boolean generateServiceFee;
|
||||
|
||||
/** 套餐价格启用,默认true */
|
||||
@TableField("enable_package_price")
|
||||
private Boolean enablePackagePrice;
|
||||
|
||||
/** 套餐金额,默认0.00 */
|
||||
private BigDecimal packageAmount;
|
||||
|
||||
/** 服务费,默认0.00 */
|
||||
private BigDecimal serviceFee;
|
||||
|
||||
/** LIS分组ID */
|
||||
private String lisGroup;
|
||||
|
||||
/** 血量 */
|
||||
private String bloodVolume;
|
||||
|
||||
/** 备注 */
|
||||
private String remarks;
|
||||
|
||||
/** 卫生机构名称 */
|
||||
private String orgName;
|
||||
|
||||
/** 制单人 */
|
||||
private String createBy;
|
||||
|
||||
/** 创建时间 */
|
||||
@TableField("create_time")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/** 更新时间 */
|
||||
@TableField("update_time")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/** 删除标志(false-正常,true-删除) */
|
||||
@TableLogic(value = "false", delval = "true")
|
||||
private Boolean delFlag;
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.openhis.lab.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 检验套餐明细
|
||||
*
|
||||
* @author system
|
||||
* @date 2025-12-25
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@TableName(value = "inspection_package_detail", autoResultMap = true)
|
||||
public class InspectionPackageDetail {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 明细ID */
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String detailId;
|
||||
|
||||
/** 套餐ID */
|
||||
@JsonProperty("packageId") // 保持向后兼容
|
||||
private String basicInformationId;
|
||||
|
||||
/** 套餐名称 */
|
||||
private String packageName;
|
||||
|
||||
/** 项目名称 */
|
||||
private String itemName;
|
||||
|
||||
/** 剂量 */
|
||||
private String dosage;
|
||||
|
||||
/** 途径 */
|
||||
private String route;
|
||||
|
||||
/** 频次 */
|
||||
private String frequency;
|
||||
|
||||
/** 天数 */
|
||||
private Integer days;
|
||||
|
||||
/** 数量,默认1 */
|
||||
private Integer quantity;
|
||||
|
||||
/** 单位 */
|
||||
private String unit;
|
||||
|
||||
/** 单价 */
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
/** 金额 */
|
||||
private BigDecimal amount;
|
||||
|
||||
/** 服务费,默认0.00 */
|
||||
private BigDecimal serviceFee;
|
||||
|
||||
/** 总金额 */
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/** 产地 */
|
||||
private String origin;
|
||||
|
||||
/** 创建时间 */
|
||||
@TableField("create_time")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/** 更新时间 */
|
||||
@TableField("update_time")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/** 删除标志(false-正常,true-删除) */
|
||||
@TableLogic(value = "false", delval = "true")
|
||||
private Boolean delFlag;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.openhis.lab.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.openhis.lab.domain.InspectionPackageDetail;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 检验套餐明细Mapper接口
|
||||
*
|
||||
* @author system
|
||||
* @date 2025-12-25
|
||||
*/
|
||||
@Mapper
|
||||
public interface InspectionPackageDetailMapper extends BaseMapper<InspectionPackageDetail> {
|
||||
|
||||
/**
|
||||
* 根据套餐ID批量删除明细数据
|
||||
* @param packageId 套餐ID
|
||||
* @return 删除的记录数
|
||||
*/
|
||||
int deleteByPackageId(String packageId);
|
||||
|
||||
/**
|
||||
* 根据套餐ID查询明细列表
|
||||
* @param packageId 套餐ID
|
||||
* @return 明细列表
|
||||
*/
|
||||
List<InspectionPackageDetail> selectByPackageId(String packageId);
|
||||
|
||||
/**
|
||||
* 批量插入明细数据
|
||||
* @param details 明细数据列表
|
||||
* @return 插入的记录数
|
||||
*/
|
||||
int batchInsert(List<InspectionPackageDetail> details);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.openhis.lab.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.openhis.lab.domain.InspectionPackage;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 检验套餐Mapper接口
|
||||
*
|
||||
* @author system
|
||||
* @date 2025-12-25
|
||||
*/
|
||||
@Mapper
|
||||
public interface InspectionPackageMapper extends BaseMapper<InspectionPackage> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.openhis.lab.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.openhis.lab.domain.InspectionPackageDetail;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 检验套餐明细Service接口
|
||||
*
|
||||
* @author system
|
||||
* @date 2025-12-25
|
||||
*/
|
||||
public interface IInspectionPackageDetailService extends IService<InspectionPackageDetail> {
|
||||
|
||||
/**
|
||||
* 根据套餐ID查询明细列表
|
||||
* @param packageId 套餐ID
|
||||
* @return 明细列表
|
||||
*/
|
||||
List<InspectionPackageDetail> selectDetailsByPackageId(String packageId);
|
||||
|
||||
/**
|
||||
* 批量保存明细数据
|
||||
* @param packageId 套餐ID
|
||||
* @param details 明细数据列表
|
||||
* @return 保存结果 {successCount: 成功数量, failCount: 失败数量}
|
||||
*/
|
||||
java.util.Map<String, Integer> batchSaveDetails(String packageId, List<InspectionPackageDetail> details);
|
||||
|
||||
/**
|
||||
* 保存单个明细数据
|
||||
* @param detail 明细数据
|
||||
* @return 结果
|
||||
*/
|
||||
boolean saveDetail(InspectionPackageDetail detail);
|
||||
|
||||
/**
|
||||
* 批量删除明细数据
|
||||
* @param detailIds 明细ID数组
|
||||
* @return 删除数量
|
||||
*/
|
||||
int deleteDetails(List<String> detailIds);
|
||||
|
||||
/**
|
||||
* 根据套餐ID删除所有明细数据
|
||||
* @param packageId 套餐ID
|
||||
* @return 删除数量
|
||||
*/
|
||||
int deleteByPackageId(String packageId);
|
||||
|
||||
/**
|
||||
* 计算明细数据的总金额和服务费
|
||||
* @param details 明细数据列表
|
||||
* @return {totalAmount: 总金额, totalServiceFee: 总服务费}
|
||||
*/
|
||||
java.util.Map<String, java.math.BigDecimal> calculateTotalAmount(List<InspectionPackageDetail> details);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.openhis.lab.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.openhis.lab.domain.InspectionPackage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 检验套餐Service接口
|
||||
*
|
||||
* @author system
|
||||
* @date 2025-12-25
|
||||
*/
|
||||
public interface IInspectionPackageService extends IService<InspectionPackage> {
|
||||
|
||||
/**
|
||||
* 校验套餐名称唯一性
|
||||
* @param packageName 套餐名称
|
||||
* @param orgName 机构名称
|
||||
* @param excludeId 排除的ID(用于更新时)
|
||||
* @return true-唯一,false-不唯一
|
||||
*/
|
||||
boolean checkPackageNameUnique(String packageName, String orgName, String excludeId);
|
||||
|
||||
/**
|
||||
* 根据条件查询套餐列表(分页)
|
||||
* @param inspectionPackage 查询条件
|
||||
* @param pageNum 页码
|
||||
* @param pageSize 每页数量
|
||||
* @return 套餐列表
|
||||
*/
|
||||
List<InspectionPackage> selectPackageList(InspectionPackage inspectionPackage, Integer pageNum, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 根据套餐ID查询套餐详情
|
||||
* @param packageId 套餐ID
|
||||
* @return 套餐信息
|
||||
*/
|
||||
InspectionPackage selectPackageById(String packageId);
|
||||
|
||||
/**
|
||||
* 新增检验套餐
|
||||
* @param inspectionPackage 套餐信息
|
||||
* @return 结果
|
||||
*/
|
||||
boolean insertPackage(InspectionPackage inspectionPackage);
|
||||
|
||||
/**
|
||||
* 修改检验套餐
|
||||
* @param inspectionPackage 套餐信息
|
||||
* @return 结果
|
||||
*/
|
||||
boolean updatePackage(InspectionPackage inspectionPackage);
|
||||
|
||||
/**
|
||||
* 删除检验套餐
|
||||
* @param packageId 套餐ID
|
||||
* @return 结果
|
||||
*/
|
||||
boolean deletePackage(String packageId);
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
package com.openhis.lab.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.openhis.lab.domain.InspectionPackageDetail;
|
||||
import com.openhis.lab.mapper.InspectionPackageDetailMapper;
|
||||
import com.openhis.lab.service.IInspectionPackageDetailService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 检验套餐明细Service业务层处理
|
||||
*
|
||||
* @author system
|
||||
* @date 2025-12-25
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class InspectionPackageDetailServiceImpl extends ServiceImpl<InspectionPackageDetailMapper, InspectionPackageDetail> implements IInspectionPackageDetailService {
|
||||
|
||||
@Override
|
||||
public List<InspectionPackageDetail> selectDetailsByPackageId(String packageId) {
|
||||
return this.baseMapper.selectByPackageId(packageId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Map<String, Integer> batchSaveDetails(String packageId, List<InspectionPackageDetail> details) {
|
||||
Map<String, Integer> result = new HashMap<>();
|
||||
int successCount = 0;
|
||||
int failCount = 0;
|
||||
|
||||
try {
|
||||
// 1. 先删除该套餐下的所有旧明细数据
|
||||
int deletedCount = this.baseMapper.deleteByPackageId(packageId);
|
||||
log.info("删除套餐{}的旧明细数据{}条", packageId, deletedCount);
|
||||
|
||||
// 2. 批量插入新的明细数据
|
||||
if (!CollectionUtils.isEmpty(details)) {
|
||||
// 设置套餐ID和创建时间
|
||||
for (InspectionPackageDetail detail : details) {
|
||||
detail.setBasicInformationId(packageId);
|
||||
detail.setCreateTime(LocalDateTime.now());
|
||||
detail.setUpdateTime(LocalDateTime.now());
|
||||
|
||||
// 设置默认值
|
||||
if (detail.getQuantity() == null) {
|
||||
detail.setQuantity(1);
|
||||
}
|
||||
if (detail.getServiceFee() == null) {
|
||||
detail.setServiceFee(BigDecimal.ZERO);
|
||||
}
|
||||
if (detail.getTotalAmount() == null) {
|
||||
// 计算总金额 = 金额 + 服务费
|
||||
BigDecimal totalAmount = detail.getAmount() != null ? detail.getAmount() : BigDecimal.ZERO;
|
||||
totalAmount = totalAmount.add(detail.getServiceFee());
|
||||
detail.setTotalAmount(totalAmount);
|
||||
}
|
||||
}
|
||||
|
||||
// 批量插入
|
||||
int insertedCount = this.baseMapper.batchInsert(details);
|
||||
successCount = insertedCount;
|
||||
log.info("批量插入套餐{}的新明细数据{}条", packageId, insertedCount);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("批量保存明细数据失败:packageId={}, error={}", packageId, e.getMessage(), e);
|
||||
failCount = details != null ? details.size() : 0;
|
||||
throw e; // 让事务回滚
|
||||
}
|
||||
|
||||
result.put("successCount", successCount);
|
||||
result.put("failCount", failCount);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveDetail(InspectionPackageDetail detail) {
|
||||
// 设置默认值
|
||||
if (detail.getQuantity() == null) {
|
||||
detail.setQuantity(1);
|
||||
}
|
||||
if (detail.getServiceFee() == null) {
|
||||
detail.setServiceFee(BigDecimal.ZERO);
|
||||
}
|
||||
if (detail.getTotalAmount() == null) {
|
||||
// 计算总金额 = 金额 + 服务费
|
||||
BigDecimal totalAmount = detail.getAmount() != null ? detail.getAmount() : BigDecimal.ZERO;
|
||||
totalAmount = totalAmount.add(detail.getServiceFee());
|
||||
detail.setTotalAmount(totalAmount);
|
||||
}
|
||||
|
||||
detail.setCreateTime(LocalDateTime.now());
|
||||
detail.setUpdateTime(LocalDateTime.now());
|
||||
|
||||
return this.save(detail);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteDetails(List<String> detailIds) {
|
||||
if (CollectionUtils.isEmpty(detailIds)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 逻辑删除
|
||||
return this.baseMapper.deleteBatchIds(detailIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByPackageId(String packageId) {
|
||||
return this.baseMapper.deleteByPackageId(packageId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, BigDecimal> calculateTotalAmount(List<InspectionPackageDetail> details) {
|
||||
Map<String, BigDecimal> result = new HashMap<>();
|
||||
BigDecimal totalAmount = BigDecimal.ZERO;
|
||||
BigDecimal totalServiceFee = BigDecimal.ZERO;
|
||||
|
||||
if (!CollectionUtils.isEmpty(details)) {
|
||||
for (InspectionPackageDetail detail : details) {
|
||||
if (detail.getAmount() != null) {
|
||||
totalAmount = totalAmount.add(detail.getAmount());
|
||||
}
|
||||
if (detail.getServiceFee() != null) {
|
||||
totalServiceFee = totalServiceFee.add(detail.getServiceFee());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result.put("totalAmount", totalAmount);
|
||||
result.put("totalServiceFee", totalServiceFee);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.openhis.lab.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.openhis.lab.domain.InspectionPackage;
|
||||
import com.openhis.lab.mapper.InspectionPackageMapper;
|
||||
import com.openhis.lab.service.IInspectionPackageService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 检验套餐Service业务层处理
|
||||
*
|
||||
* @author system
|
||||
* @date 2025-12-25
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class InspectionPackageServiceImpl extends ServiceImpl<InspectionPackageMapper, InspectionPackage> implements IInspectionPackageService {
|
||||
|
||||
@Override
|
||||
public boolean checkPackageNameUnique(String packageName, String orgName, String excludeId) {
|
||||
QueryWrapper<InspectionPackage> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("package_name", packageName)
|
||||
.eq("org_name", orgName)
|
||||
.eq("del_flag", false);
|
||||
if (StringUtils.hasText(excludeId)) {
|
||||
queryWrapper.ne("basic_information_id", excludeId);
|
||||
}
|
||||
return this.count(queryWrapper) == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InspectionPackage> selectPackageList(InspectionPackage inspectionPackage, Integer pageNum, Integer pageSize) {
|
||||
QueryWrapper<InspectionPackage> queryWrapper = new QueryWrapper<>();
|
||||
|
||||
// 构建查询条件
|
||||
if (StringUtils.hasText(inspectionPackage.getPackageName())) {
|
||||
queryWrapper.like("package_name", inspectionPackage.getPackageName());
|
||||
}
|
||||
if (StringUtils.hasText(inspectionPackage.getPackageLevel())) {
|
||||
queryWrapper.eq("package_level", inspectionPackage.getPackageLevel());
|
||||
}
|
||||
if (inspectionPackage.getIsDisabled() != null) {
|
||||
queryWrapper.eq("is_disabled", inspectionPackage.getIsDisabled());
|
||||
}
|
||||
|
||||
// 默认只查询未删除的记录
|
||||
queryWrapper.eq("del_flag", false);
|
||||
|
||||
// 排序
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
|
||||
if (pageNum != null && pageSize != null) {
|
||||
Page<InspectionPackage> page = new Page<>(pageNum, pageSize);
|
||||
return this.page(page, queryWrapper).getRecords();
|
||||
} else {
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public InspectionPackage selectPackageById(String packageId) {
|
||||
return this.getById(packageId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insertPackage(InspectionPackage inspectionPackage) {
|
||||
// 设置默认值
|
||||
if (inspectionPackage.getDiscount() == null) {
|
||||
inspectionPackage.setDiscount(java.math.BigDecimal.ZERO);
|
||||
}
|
||||
if (inspectionPackage.getIsDisabled() == null) {
|
||||
inspectionPackage.setIsDisabled(false);
|
||||
}
|
||||
if (inspectionPackage.getShowPackageName() == null) {
|
||||
inspectionPackage.setShowPackageName(true);
|
||||
}
|
||||
if (inspectionPackage.getGenerateServiceFee() == null) {
|
||||
inspectionPackage.setGenerateServiceFee(true);
|
||||
}
|
||||
if (inspectionPackage.getEnablePackagePrice() == null) {
|
||||
inspectionPackage.setEnablePackagePrice(true);
|
||||
}
|
||||
if (inspectionPackage.getPackageAmount() == null) {
|
||||
inspectionPackage.setPackageAmount(java.math.BigDecimal.ZERO);
|
||||
}
|
||||
if (inspectionPackage.getServiceFee() == null) {
|
||||
inspectionPackage.setServiceFee(java.math.BigDecimal.ZERO);
|
||||
}
|
||||
|
||||
// 设置创建时间
|
||||
inspectionPackage.setCreateTime(LocalDateTime.now());
|
||||
inspectionPackage.setUpdateTime(LocalDateTime.now());
|
||||
|
||||
return this.save(inspectionPackage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updatePackage(InspectionPackage inspectionPackage) {
|
||||
// 设置更新时间
|
||||
inspectionPackage.setUpdateTime(LocalDateTime.now());
|
||||
|
||||
return this.updateById(inspectionPackage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deletePackage(String packageId) {
|
||||
// 逻辑删除
|
||||
InspectionPackage inspectionPackage = new InspectionPackage();
|
||||
inspectionPackage.setBasicInformationId(packageId);
|
||||
inspectionPackage.setUpdateTime(LocalDateTime.now());
|
||||
|
||||
return this.removeById(packageId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.openhis.lab.mapper.InspectionPackageDetailMapper">
|
||||
|
||||
<!-- 根据套餐ID删除明细数据 -->
|
||||
<delete id="deleteByPackageId">
|
||||
DELETE FROM inspection_package_detail
|
||||
WHERE basic_information_id = #{packageId} AND del_flag = false
|
||||
</delete>
|
||||
|
||||
<!-- 根据套餐ID查询明细列表 -->
|
||||
<select id="selectByPackageId" resultType="com.openhis.lab.domain.InspectionPackageDetail">
|
||||
SELECT
|
||||
detail_id,
|
||||
basic_information_id,
|
||||
package_name,
|
||||
item_name,
|
||||
dosage,
|
||||
route,
|
||||
frequency,
|
||||
days,
|
||||
quantity,
|
||||
unit,
|
||||
unit_price,
|
||||
amount,
|
||||
service_fee,
|
||||
total_amount,
|
||||
origin,
|
||||
create_time,
|
||||
update_time,
|
||||
del_flag
|
||||
FROM inspection_package_detail
|
||||
WHERE basic_information_id = #{packageId} AND del_flag = false
|
||||
ORDER BY create_time ASC
|
||||
</select>
|
||||
|
||||
<!-- 批量插入明细数据 -->
|
||||
<insert id="batchInsert">
|
||||
INSERT INTO inspection_package_detail (
|
||||
detail_id,
|
||||
basic_information_id,
|
||||
package_name,
|
||||
item_name,
|
||||
dosage,
|
||||
route,
|
||||
frequency,
|
||||
days,
|
||||
quantity,
|
||||
unit,
|
||||
unit_price,
|
||||
amount,
|
||||
service_fee,
|
||||
total_amount,
|
||||
origin,
|
||||
create_time,
|
||||
update_time,
|
||||
del_flag
|
||||
) VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.detailId},
|
||||
#{item.basicInformationId},
|
||||
#{item.packageName},
|
||||
#{item.itemName},
|
||||
#{item.dosage},
|
||||
#{item.route},
|
||||
#{item.frequency},
|
||||
#{item.days},
|
||||
#{item.quantity},
|
||||
#{item.unit},
|
||||
#{item.unitPrice},
|
||||
#{item.amount},
|
||||
#{item.serviceFee},
|
||||
#{item.totalAmount},
|
||||
#{item.origin},
|
||||
#{item.createTime},
|
||||
#{item.updateTime},
|
||||
#{item.delFlag}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user