``` refactor(db): 移除SQL语句中的public schema前缀
This commit is contained in:
@@ -2,6 +2,8 @@ package com.openhis.administration.domain;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.core.common.core.domain.HisBaseEntity;
|
||||
|
||||
@@ -22,7 +24,7 @@ import lombok.experimental.Accessors;
|
||||
public class BizUser extends HisBaseEntity {
|
||||
|
||||
/** 用户ID */
|
||||
// @TableId(type = IdType.ASSIGN_ID)
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long userId;
|
||||
|
||||
/** 部门ID */
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.openhis.administration.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import lombok.Data;
|
||||
@@ -19,6 +21,7 @@ import lombok.experimental.Accessors;
|
||||
public class BizUserRole {
|
||||
|
||||
/** 用户ID */
|
||||
@TableId(type = IdType.INPUT)
|
||||
private Long userId;
|
||||
|
||||
/** 角色ID */
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import com.core.common.core.domain.HisBaseEntity;
|
||||
import com.openhis.common.enums.InvoiceStatus;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
@@ -25,58 +26,100 @@ import lombok.experimental.Accessors;
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class Invoice extends HisBaseEntity {
|
||||
|
||||
/** ID */
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/** 患者ID */
|
||||
/**
|
||||
* 患者ID
|
||||
*/
|
||||
private Long patientId;
|
||||
|
||||
/** 付款ID */
|
||||
/**
|
||||
* 付款ID
|
||||
*/
|
||||
private Long reconciliationId;
|
||||
|
||||
/** 状态 */
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private InvoiceStatus statusEnum;
|
||||
|
||||
/** 类别 */
|
||||
/**
|
||||
* 类别
|
||||
*/
|
||||
private String typeCode;
|
||||
|
||||
/** 取消原因 */
|
||||
/**
|
||||
* 取消原因
|
||||
*/
|
||||
private String cancelledReason;
|
||||
|
||||
/** 收费项 */
|
||||
/**
|
||||
* 收费项
|
||||
*/
|
||||
private String chargeItemIds;
|
||||
|
||||
/** 发票净额总记 */
|
||||
/**
|
||||
* 发票净额总记
|
||||
*/
|
||||
private BigDecimal totalNet;
|
||||
|
||||
/** 发票总计金额 */
|
||||
/**
|
||||
* 发票总计金额
|
||||
*/
|
||||
private BigDecimal totalGross;
|
||||
|
||||
/** 付款详情 */
|
||||
/**
|
||||
* 付款详情
|
||||
*/
|
||||
private String paymentTerms;
|
||||
|
||||
/** 发票编号 */
|
||||
/**
|
||||
* 发票编号
|
||||
*/
|
||||
private String busNo;
|
||||
|
||||
/** 开票员 */
|
||||
/**
|
||||
* 开票员
|
||||
*/
|
||||
private Long invoicingStaffId;
|
||||
/** 电子票据代码 */
|
||||
/**
|
||||
* 电子票据代码
|
||||
*/
|
||||
private String billBatchCode;
|
||||
/** 电子票据号码 */
|
||||
/**
|
||||
* 电子票据号码
|
||||
*/
|
||||
private String billNo;
|
||||
/** 电子校验码 */
|
||||
/**
|
||||
* 电子校验码
|
||||
*/
|
||||
private String random;
|
||||
/** 电子票据生成时间 */
|
||||
/**
|
||||
* 电子票据生成时间
|
||||
*/
|
||||
private String billCreateTime;
|
||||
/** 电子票据二维码图片数据 */
|
||||
/**
|
||||
* 电子票据二维码图片数据
|
||||
*/
|
||||
private String billQrCode;
|
||||
/** 电子票据H5页面URL */
|
||||
/**
|
||||
* 电子票据H5页面URL
|
||||
*/
|
||||
private String pictureUrl;
|
||||
/** 电子票据外网H5页面URL */
|
||||
/**
|
||||
* 电子票据外网H5页面URL
|
||||
*/
|
||||
private String pictureNetUrl;
|
||||
/** 微信插卡URL */
|
||||
/**
|
||||
* 微信插卡URL
|
||||
*/
|
||||
private String wxCardUrl;
|
||||
/** 票据营业日期 */
|
||||
/**
|
||||
* 票据营业日期
|
||||
*/
|
||||
private Date billBusDate;
|
||||
}
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
package com.openhis.administration.domain;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import com.core.common.core.domain.HisBaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 发票段管理Entity实体
|
||||
@@ -17,43 +12,217 @@ import lombok.experimental.Accessors;
|
||||
* @author system
|
||||
* @date 2025-11-18
|
||||
*/
|
||||
@Data
|
||||
@TableName("adm_invoice_segment")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class InvoiceSegment extends HisBaseEntity {
|
||||
|
||||
/** ID */
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/** 段ID */
|
||||
|
||||
/**
|
||||
* 段ID
|
||||
*/
|
||||
private Long segmentId;
|
||||
|
||||
/** 开始号码 */
|
||||
/**
|
||||
* 开始号码
|
||||
*/
|
||||
private String beginNumber;
|
||||
|
||||
/** 结束号码 */
|
||||
|
||||
/**
|
||||
* 结束号码
|
||||
*/
|
||||
private String endNumber;
|
||||
|
||||
/** 员工ID */
|
||||
|
||||
/**
|
||||
* 员工ID
|
||||
*/
|
||||
private Long employeeId;
|
||||
|
||||
/** 员工姓名 */
|
||||
|
||||
/**
|
||||
* 员工姓名
|
||||
*/
|
||||
private String employeeName;
|
||||
|
||||
/** 开票员ID */
|
||||
|
||||
/**
|
||||
* 开票员ID
|
||||
*/
|
||||
private Long invoicingStaffId;
|
||||
|
||||
/** 开票员姓名 */
|
||||
|
||||
/**
|
||||
* 开票员姓名
|
||||
*/
|
||||
private String invoicingStaffName;
|
||||
|
||||
/** 创建日期 */
|
||||
|
||||
/**
|
||||
* 创建日期
|
||||
*/
|
||||
private Date createDate;
|
||||
|
||||
/** 状态 */
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/** 备注 */
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
}
|
||||
|
||||
// ===== 标准getter/setter方法 =====
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getSegmentId() {
|
||||
return segmentId;
|
||||
}
|
||||
|
||||
public void setSegmentId(Long segmentId) {
|
||||
this.segmentId = segmentId;
|
||||
}
|
||||
|
||||
public String getBeginNumber() {
|
||||
return beginNumber;
|
||||
}
|
||||
|
||||
public void setBeginNumber(String beginNumber) {
|
||||
this.beginNumber = beginNumber;
|
||||
}
|
||||
|
||||
public String getEndNumber() {
|
||||
return endNumber;
|
||||
}
|
||||
|
||||
public void setEndNumber(String endNumber) {
|
||||
this.endNumber = endNumber;
|
||||
}
|
||||
|
||||
public Long getEmployeeId() {
|
||||
return employeeId;
|
||||
}
|
||||
|
||||
public void setEmployeeId(Long employeeId) {
|
||||
this.employeeId = employeeId;
|
||||
}
|
||||
|
||||
public String getEmployeeName() {
|
||||
return employeeName;
|
||||
}
|
||||
|
||||
public void setEmployeeName(String employeeName) {
|
||||
this.employeeName = employeeName;
|
||||
}
|
||||
|
||||
public Long getInvoicingStaffId() {
|
||||
return invoicingStaffId;
|
||||
}
|
||||
|
||||
public void setInvoicingStaffId(Long invoicingStaffId) {
|
||||
this.invoicingStaffId = invoicingStaffId;
|
||||
}
|
||||
|
||||
public String getInvoicingStaffName() {
|
||||
return invoicingStaffName;
|
||||
}
|
||||
|
||||
public void setInvoicingStaffName(String invoicingStaffName) {
|
||||
this.invoicingStaffName = invoicingStaffName;
|
||||
}
|
||||
|
||||
public Date getCreateDate() {
|
||||
return createDate;
|
||||
}
|
||||
|
||||
public void setCreateDate(Date createDate) {
|
||||
this.createDate = createDate;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
// ===== 业务验证方法 =====
|
||||
/**
|
||||
* 验证发票段数据完整性
|
||||
*
|
||||
* @return 验证结果,true表示通过
|
||||
*/
|
||||
public boolean isValidInvoiceSegment() {
|
||||
return id != null
|
||||
&& segmentId != null
|
||||
&& beginNumber != null && !beginNumber.trim().isEmpty()
|
||||
&& endNumber != null && !endNumber.trim().isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查号码范围是否有效
|
||||
*
|
||||
* @return true如果开始号码不大于结束号码
|
||||
*/
|
||||
public boolean isNumberRangeValid() {
|
||||
if (beginNumber == null || endNumber == null) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
long begin = Long.parseLong(beginNumber.trim());
|
||||
long end = Long.parseLong(endNumber.trim());
|
||||
return begin <= end;
|
||||
} catch (NumberFormatException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// ===== 重写equals和hashCode方法 =====
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null || getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
InvoiceSegment that = (InvoiceSegment) obj;
|
||||
|
||||
return id != null ? id.equals(that.id) : that.id == null
|
||||
&& segmentId != null ? segmentId.equals(that.segmentId) : that.segmentId == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = id != null ? id.hashCode() : 0;
|
||||
result = 31 * result + (segmentId != null ? segmentId.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "InvoiceSegment{"
|
||||
+ "id=" + id
|
||||
+ ", segmentId=" + segmentId
|
||||
+ ", beginNumber='" + beginNumber + '\''
|
||||
+ ", endNumber='" + endNumber + '\''
|
||||
+ ", employeeName='" + employeeName + '\''
|
||||
+ ", status='" + status + '\''
|
||||
+ '}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.openhis.administration.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
package com.openhis.administration.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.core.common.enums.DelFlag;
|
||||
import com.core.common.exception.ServiceException;
|
||||
import com.openhis.administration.domain.Invoice;
|
||||
import com.openhis.administration.mapper.InvoiceMapper;
|
||||
import com.openhis.administration.service.IInvoiceService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -28,22 +23,20 @@ public class InvoiceServiceImpl extends ServiceImpl<InvoiceMapper, Invoice> impl
|
||||
* 新增发票
|
||||
*
|
||||
* @param invoice 发票实体
|
||||
* @return 发票ID
|
||||
* @throws ServiceException 当发票已存在或插入失败时抛出异常
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long addInvoice(Invoice invoice) {
|
||||
// 根据编码判断发票是否存在 - 使用count查询优化性能
|
||||
long count = baseMapper.selectCount(new LambdaQueryWrapper<Invoice>().eq(Invoice::getBusNo, invoice.getBusNo()));
|
||||
if (count > 0) {
|
||||
throw new ServiceException("发票编码已存在: " + invoice.getBusNo());
|
||||
// 根据编码判断发票是否存在
|
||||
List<Invoice> invoices
|
||||
= baseMapper.selectList(new LambdaQueryWrapper<Invoice>().eq(Invoice::getBusNo, invoice.getBusNo()));
|
||||
if (invoices.size() > 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 新增发票
|
||||
int insert = baseMapper.insert(invoice);
|
||||
if (insert != 1) {
|
||||
throw new ServiceException("发票新增失败,请检查输入数据");
|
||||
return null;
|
||||
}
|
||||
|
||||
return invoice.getId();
|
||||
@@ -55,16 +48,14 @@ public class InvoiceServiceImpl extends ServiceImpl<InvoiceMapper, Invoice> impl
|
||||
.eq(Invoice::getDeleteFlag, DelFlag.NO.getCode()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询发票列表
|
||||
*/
|
||||
@Override
|
||||
public IPage<Invoice> selectInvoicePage(Page<Invoice> page, boolean isAdmin, Long userId) {
|
||||
LambdaQueryWrapper<Invoice> queryWrapper = new LambdaQueryWrapper<Invoice>()
|
||||
.eq(Invoice::getDeleteFlag, DelFlag.NO.getCode());
|
||||
|
||||
// 非管理员用户只能查看自己创建的发票
|
||||
if (!isAdmin) {
|
||||
queryWrapper.eq(Invoice::getInvoicingStaffId, userId);
|
||||
}
|
||||
|
||||
public Page<Invoice> selectInvoicePage(Page<Invoice> page, boolean isAdmin, Long userId) {
|
||||
LambdaQueryWrapper<Invoice> queryWrapper = new LambdaQueryWrapper<>();
|
||||
// 可以根据需要添加查询条件,目前按创建时间倒序排列
|
||||
queryWrapper.orderByDesc(Invoice::getCreateTime);
|
||||
return baseMapper.selectPage(page, queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,6 @@
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<<<<<<<< HEAD:openhis-server-new/openhis-domain/src/main/resources/mapper/administration/PatientStudentMapper.xml
|
||||
<mapper namespace="com.openhis.administration.mapper.PatientStudentMapper">
|
||||
========
|
||||
<mapper namespace="com.openhis.administration.mapper.InstrumentMapper">
|
||||
>>>>>>>> v1.3:openhis-server-new/openhis-domain/src/main/resources/mapper/administration/InstrumentMapper.xml
|
||||
|
||||
</mapper>
|
||||
@@ -2,10 +2,6 @@
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<<<<<<<< HEAD:openhis-server-new/openhis-domain/src/main/resources/mapper/administration/PatientStudentMapper.xml
|
||||
<mapper namespace="com.openhis.administration.mapper.PatientStudentMapper">
|
||||
========
|
||||
<mapper namespace="com.openhis.administration.mapper.InstrumentMapper">
|
||||
>>>>>>>> v1.3:openhis-server-new/openhis-domain/src/main/resources/mapper/administration/InstrumentMapper.xml
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user