zjh
2025-06-18 b115eea2b161adddeb92c5e885019aba8763bb0e
ltkj-hosp/src/main/resources/mapper/hosp/TjDwGroupingMapper.xml
@@ -5,204 +5,233 @@
<mapper namespace="com.ltkj.hosp.mapper.TjDwGroupingMapper">
    <resultMap type="TjDwGrouping" id="TjDwGroupingResult">
            <result property="id" column="id"/>
            <result property="dwId" column="dw_id"/>
            <result property="dwName" column="dw_name"/>
            <result property="dwDeptId" column="dw_dept_id"/>
            <result property="dwDeptName" column="dw_dept_name"/>
            <result property="groupingName" column="grouping_name"/>
            <result property="limit" column="limit"/>
            <result property="pacName" column="pac_name"/>
            <result property="payType" column="pay_type"/>
            <result property="sex" column="sex"/>
            <result property="gtAge" column="gt_age"/>
            <result property="ltAge" column="lt_age"/>
            <result property="createBy" column="create_by"/>
            <result property="updateTime" column="update_time"/>
            <result property="updateBy" column="update_by"/>
            <result property="deleted" column="deleted"/>
        <result property="id" column="id"/>
        <result property="dwId" column="dw_id"/>
        <result property="dwName" column="dw_name"/>
        <result property="dwDeptId" column="dw_dept_id"/>
        <result property="dwDeptName" column="dw_dept_name"/>
        <result property="groupingName" column="grouping_name"/>
        <result property="limit" column="limit"/>
        <result property="pacName" column="pac_name"/>
        <result property="payType" column="pay_type"/>
        <result property="sex" column="sex"/>
        <result property="gtAge" column="gt_age"/>
        <result property="ltAge" column="lt_age"/>
        <result property="createBy" column="create_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="deleted" column="deleted"/>
    </resultMap>
    <sql id="selectTjDwGroupingVo">
        select id, dw_id, dw_name, dw_dept_id, dw_dept_name, grouping_name, limit, pac_name, pay_type, sex, gt_age, lt_age, create_by, update_time, update_by, deleted
        select id,
               dw_id,
               dw_name,
               dw_dept_id,
               dw_dept_name,
               grouping_name,
               limit,
               pac_name,
               pay_type,
               sex,
               gt_age,
               lt_age,
               create_by,
               update_time,
               update_by,
               deleted
        from tj_dw_grouping
    </sql>
    <select id="selectTjDwGroupingList" parameterType="TjDwGrouping" resultMap="TjDwGroupingResult">
        <include refid="selectTjDwGroupingVo"/>
        <where>
                        <if test="dwId != null  and dwId != ''">
                            and dw_id = #{dwId}
                        </if>
                        <if test="dwName != null  and dwName != ''">
                            and dw_name like concat('%', #{dwName}, '%')
                        </if>
                        <if test="dwDeptId != null  and dwDeptId != ''">
                            and dw_dept_id = #{dwDeptId}
                        </if>
                        <if test="dwDeptName != null  and dwDeptName != ''">
                            and dw_dept_name like concat('%', #{dwDeptName}, '%')
                        </if>
                        <if test="groupingName != null  and groupingName != ''">
                            and grouping_name like concat('%', #{groupingName}, '%')
                        </if>
                        <if test="limit != null ">
                            and limit = #{limit}
                        </if>
                        <if test="pacName != null  and pacName != ''">
                            and pac_name like concat('%', #{pacName}, '%')
                        </if>
                        <if test="payType != null  and payType != ''">
                            and pay_type = #{payType}
                        </if>
                        <if test="sex != null  and sex != ''">
                            and sex = #{sex}
                        </if>
                        <if test="gtAge != null  and gtAge != ''">
                            and gt_age = #{gtAge}
                        </if>
                        <if test="ltAge != null  and ltAge != ''">
                            and lt_age = #{ltAge}
                        </if>
                        <if test="deleted != null ">
                            and deleted = #{deleted}
                        </if>
            <if test="dwId != null  and dwId != ''">
                and dw_id = #{dwId}
            </if>
            <if test="dwName != null  and dwName != ''">
                and dw_name like concat('%', #{dwName}, '%')
            </if>
            <if test="dwDeptId != null  and dwDeptId != ''">
                and dw_dept_id = #{dwDeptId}
            </if>
            <if test="dwDeptName != null  and dwDeptName != ''">
                and dw_dept_name like concat('%', #{dwDeptName}, '%')
            </if>
            <if test="groupingName != null  and groupingName != ''">
                and grouping_name like concat('%', #{groupingName}, '%')
            </if>
            <if test="limit != null ">
                and limit = #{limit}
            </if>
            <if test="pacName != null  and pacName != ''">
                and pac_name like concat('%', #{pacName}, '%')
            </if>
            <if test="payType != null  and payType != ''">
                and pay_type = #{payType}
            </if>
            <if test="sex != null  and sex != ''">
                and sex = #{sex}
            </if>
            <if test="gtAge != null  and gtAge != ''">
                and gt_age = #{gtAge}
            </if>
            <if test="ltAge != null  and ltAge != ''">
                and lt_age = #{ltAge}
            </if>
            <if test="deleted != null ">
                and deleted = #{deleted}
            </if>
        </where>
    </select>
    <select id="selectTjDwGroupingById" parameterType="String"
            resultMap="TjDwGroupingResult">
            <include refid="selectTjDwGroupingVo"/>
            where id = #{id}
        <include refid="selectTjDwGroupingVo"/>
        where id = #{id}
    </select>
    <select id="huoqutuantitaocanxiangmuhuoqutuantitaocanxiangmuList" parameterType="string"
            resultType="com.ltkj.hosp.domain.TjPackage">
        SELECT a.id pac_id,grouping_name pac_name,a.ys_price price , GROUP_CONCAT(b.pro_name ORDER BY b.pro_name)
        allProName FROM
        tj_dw_grouping a JOIN tj_grouping_pro b ON b.grouping_id=a.id
        <where>
            <if test="dwId != null" >
                and a.dw_id = #{dwId}
            </if>
            and a.deleted=0 GROUP BY b.grouping_id
        </where>
    </select>
    <insert id="insertTjDwGrouping" parameterType="TjDwGrouping">
        insert into tj_dw_grouping
        <trim prefix="(" suffix=")" suffixOverrides=",">
                    <if test="id != null">id,
                    </if>
                    <if test="dwId != null">dw_id,
                    </if>
                    <if test="dwName != null">dw_name,
                    </if>
                    <if test="dwDeptId != null">dw_dept_id,
                    </if>
                    <if test="dwDeptName != null">dw_dept_name,
                    </if>
                    <if test="groupingName != null">grouping_name,
                    </if>
                    <if test="limit != null">limit,
                    </if>
                    <if test="pacName != null">pac_name,
                    </if>
                    <if test="payType != null">pay_type,
                    </if>
                    <if test="sex != null">sex,
                    </if>
                    <if test="gtAge != null">gt_age,
                    </if>
                    <if test="ltAge != null">lt_age,
                    </if>
                    <if test="createBy != null">create_by,
                    </if>
                    <if test="updateTime != null">update_time,
                    </if>
                    <if test="updateBy != null">update_by,
                    </if>
                    <if test="deleted != null">deleted,
                    </if>
            <if test="id != null">id,
            </if>
            <if test="dwId != null">dw_id,
            </if>
            <if test="dwName != null">dw_name,
            </if>
            <if test="dwDeptId != null">dw_dept_id,
            </if>
            <if test="dwDeptName != null">dw_dept_name,
            </if>
            <if test="groupingName != null">grouping_name,
            </if>
            <if test="limit != null">limit,
            </if>
            <if test="pacName != null">pac_name,
            </if>
            <if test="payType != null">pay_type,
            </if>
            <if test="sex != null">sex,
            </if>
            <if test="gtAge != null">gt_age,
            </if>
            <if test="ltAge != null">lt_age,
            </if>
            <if test="createBy != null">create_by,
            </if>
            <if test="updateTime != null">update_time,
            </if>
            <if test="updateBy != null">update_by,
            </if>
            <if test="deleted != null">deleted,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                    <if test="id != null">#{id},
                    </if>
                    <if test="dwId != null">#{dwId},
                    </if>
                    <if test="dwName != null">#{dwName},
                    </if>
                    <if test="dwDeptId != null">#{dwDeptId},
                    </if>
                    <if test="dwDeptName != null">#{dwDeptName},
                    </if>
                    <if test="groupingName != null">#{groupingName},
                    </if>
                    <if test="limit != null">#{limit},
                    </if>
                    <if test="pacName != null">#{pacName},
                    </if>
                    <if test="payType != null">#{payType},
                    </if>
                    <if test="sex != null">#{sex},
                    </if>
                    <if test="gtAge != null">#{gtAge},
                    </if>
                    <if test="ltAge != null">#{ltAge},
                    </if>
                    <if test="createBy != null">#{createBy},
                    </if>
                    <if test="updateTime != null">#{updateTime},
                    </if>
                    <if test="updateBy != null">#{updateBy},
                    </if>
                    <if test="deleted != null">#{deleted},
                    </if>
            <if test="id != null">#{id},
            </if>
            <if test="dwId != null">#{dwId},
            </if>
            <if test="dwName != null">#{dwName},
            </if>
            <if test="dwDeptId != null">#{dwDeptId},
            </if>
            <if test="dwDeptName != null">#{dwDeptName},
            </if>
            <if test="groupingName != null">#{groupingName},
            </if>
            <if test="limit != null">#{limit},
            </if>
            <if test="pacName != null">#{pacName},
            </if>
            <if test="payType != null">#{payType},
            </if>
            <if test="sex != null">#{sex},
            </if>
            <if test="gtAge != null">#{gtAge},
            </if>
            <if test="ltAge != null">#{ltAge},
            </if>
            <if test="createBy != null">#{createBy},
            </if>
            <if test="updateTime != null">#{updateTime},
            </if>
            <if test="updateBy != null">#{updateBy},
            </if>
            <if test="deleted != null">#{deleted},
            </if>
        </trim>
    </insert>
    <update id="updateTjDwGrouping" parameterType="TjDwGrouping">
        update tj_dw_grouping
        <trim prefix="SET" suffixOverrides=",">
                    <if test="dwId != null">dw_id =
                        #{dwId},
                    </if>
                    <if test="dwName != null">dw_name =
                        #{dwName},
                    </if>
                    <if test="dwDeptId != null">dw_dept_id =
                        #{dwDeptId},
                    </if>
                    <if test="dwDeptName != null">dw_dept_name =
                        #{dwDeptName},
                    </if>
                    <if test="groupingName != null">grouping_name =
                        #{groupingName},
                    </if>
                    <if test="limit != null">limit =
                        #{limit},
                    </if>
                    <if test="pacName != null">pac_name =
                        #{pacName},
                    </if>
                    <if test="payType != null">pay_type =
                        #{payType},
                    </if>
                    <if test="sex != null">sex =
                        #{sex},
                    </if>
                    <if test="gtAge != null">gt_age =
                        #{gtAge},
                    </if>
                    <if test="ltAge != null">lt_age =
                        #{ltAge},
                    </if>
                    <if test="createBy != null">create_by =
                        #{createBy},
                    </if>
                    <if test="updateTime != null">update_time =
                        #{updateTime},
                    </if>
                    <if test="updateBy != null">update_by =
                        #{updateBy},
                    </if>
                    <if test="deleted != null">deleted =
                        #{deleted},
                    </if>
            <if test="dwId != null">dw_id =
                #{dwId},
            </if>
            <if test="dwName != null">dw_name =
                #{dwName},
            </if>
            <if test="dwDeptId != null">dw_dept_id =
                #{dwDeptId},
            </if>
            <if test="dwDeptName != null">dw_dept_name =
                #{dwDeptName},
            </if>
            <if test="groupingName != null">grouping_name =
                #{groupingName},
            </if>
            <if test="limit != null">limit =
                #{limit},
            </if>
            <if test="pacName != null">pac_name =
                #{pacName},
            </if>
            <if test="payType != null">pay_type =
                #{payType},
            </if>
            <if test="sex != null">sex =
                #{sex},
            </if>
            <if test="gtAge != null">gt_age =
                #{gtAge},
            </if>
            <if test="ltAge != null">lt_age =
                #{ltAge},
            </if>
            <if test="createBy != null">create_by =
                #{createBy},
            </if>
            <if test="updateTime != null">update_time =
                #{updateTime},
            </if>
            <if test="updateBy != null">update_by =
                #{updateBy},
            </if>
            <if test="deleted != null">deleted =
                #{deleted},
            </if>
        </trim>
        where id = #{id}
    </update>
    <delete id="deleteTjDwGroupingById" parameterType="String">
        delete
        from tj_dw_grouping where id = #{id}
        from tj_dw_grouping
        where id = #{id}
    </delete>
    <delete id="deleteTjDwGroupingByIds" parameterType="String">
@@ -211,4 +240,4 @@
            #{id}
        </foreach>
    </delete>
</mapper>
</mapper>