liusheng
8 天以前 34f78281cf395a24e1f3f1c3b861186ff8a03b7b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
package com.ruoyi.outpatientvisit.mapper;
 
import java.util.Collection;
import java.util.List;
import java.util.Map;
 
// 迁移前这里是 `import com.smartor.domain.*;`(通配符)。
// 本接口随实体一起搬进本模块后,实体已在同模块的 domain 包里,故改为显式导入
// —— 通配符是那个时代的写法,显式导入更能防止"搬走后再也解析不到"。
import com.ruoyi.outpatientvisit.domain.PatMedOuthosp;
import com.ruoyi.outpatientvisit.domain.PatMedOuthospQueryReq;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
 
/**
 * 患者门诊记录Mapper接口
 *
 * @author smartor
 * @date 2023-03-04
 */
@Mapper
public interface PatMedOuthospMapper {
 
    /**
     * 新增患者门诊记录
     *
     * @param patMedOuthosp 患者门诊记录
     * @return 结果
     */
//    public int insertPatMedOuthosp(PatMedOuthosp patMedOuthosp);
 
    /**
     * 新增到指定分表(用于路由到最新分表)
     *
     * @param tableName 目标表名
     * @param record    门诊记录
     * @return 插入条数
     */
    int insertIntoTable(@Param("tableName") String tableName, @Param("record") PatMedOuthosp record);
 
 
    /**
     * 判断指定分表中是否存在该 id
     */
    int existsInTable(@Param("tableName") String tableName, @Param("id") Long id);
 
    /**
     * 按 serialnum 查询指定分表中是否已存在该记录,用于插入前去重
     */
    int countBySerialnum(@Param("tableName") String tableName, @Param("serialnum") String serialnum);
 
    /**
     * 更新到指定分表(用于路由到正确分表)
     */
    int updateInTable(@Param("tableName") String tableName, @Param("record") PatMedOuthosp record);
 
    /**
     * 调用存储过程 sp_query_outhosp 查询门诊记录
     *
     * @param req 入参对象
     * @return 门诊记录列表
     */
    List<PatMedOuthosp> callSpQueryOuthosp(PatMedOuthospQueryReq req);
 
    /**
     * 调用存储过程 sp_query_outhosp 查询门诊记录数量
     *
     * @param req 入参对象
     * @return 门诊记录列表
     */
    Long callSpQueryOuthospCount(PatMedOuthospQueryReq req);
 
 
    /**
     * 修改患者门诊记录
     *
     * @param patMedOuthosp 患者门诊记录
     * @return 结果
     */
//    public int updatePatMedOuthosp(PatMedOuthosp patMedOuthosp);
 
 
    /**
     * 创建新表
     *
     * @param templateName 模板表名
     * @param newName      新表名
     */
    void createPatMedOuthosp(@Param("templateName") String templateName, @Param("newName") String newName);
 
    void createPatMedOuthospAutoAdd(@Param("newName") String newName);
 
    void setAutoIncrement(@Param("tableName") String tableName, @Param("autoInc") long autoInc);
 
    // 查询所有 pat_med_outhosp 开头的表名
    List<String> getAllOuthospTableNames();
 
    /**
     * 批量查询指定分表中已存在的 serialnum(一次 SQL 代替逐条 countBySerialnum)
     *
     * @param tableName  分表名
     * @param serialnums 待查询的诊疗记录号
     * @return 已存在的 serialnum 集合
     */
    List<String> selectExistingSerialnums(@Param("tableName") String tableName, @Param("serialnums") Collection<String> serialnums);
 
    // 查询指定表的字段列表(按 ordinal_position 排序)
    List<String> getTableColumns(@Param("tableName") String tableName);
 
    /**
     * 查询指定表的字段元数据(column_name, data_type, column_type)
     *
     * @param tableName 表名
     * @return 每行包含 column_name / data_type / column_type
     */
    List<Map<String, String>> getTableColumnMeta(@Param("tableName") String tableName);
 
 
    /**
     * 创建或更新存储过程(支持 DROP / CREATE PROCEDURE 语句)
     */
    void createOrReplaceProcedure(@Param("procSql") String procSql);
 
    /**
     * 检查表是否已存在
     *
     * @param tableName 表名
     * @return 存在返回1,不存在返回0
     */
    int tableExists(@Param("tableName") String tableName);
}